[TYPO3] After using the API to copy a page, sql_insert_id() is 0. How do I get insert id?
Mike
fromlists at talkingspider.com
Mon Aug 11 23:56:07 CEST 2008
Thanks guys! It's:
$id = $tce->copyMappingArray_merged;
$id = $id['pages']['551'];
I never would have known that were it not for you. which is a bad thing.
the docs don't exactly have this info anywhere near the tc3main page..
Peter Klein wrote:
> No I haven't tested it.
> Maybe this on is better?
>
> $id = $tce->copyMappingArray_merged;
>
> --
> Peter Klein
>
> "Xavier Perseguers" <typo3 at perseguers.ch> wrote in message
> news:mailman.1.1218484360.30608.typo3-english at lists.netfielders.de...
>> Hi Peter,
>>
>>> Try:
>>>
>>> $id = $tce->substNEWwithIDs['NEW'];
>> Are you certain it works? Because I quickly read the code when this
>> question was posted and did not find a way to retrieve this information as
>> the page copy can recursively copy pages and as such there is no unique
>> uid that should be returned. The code you give looks strangely close to
>> what is needed to retrieve the uid of a newly created page, using the tce
>> too but when creating a new page from scratch.
>>
>> But I may be wrong!
>>
>>>> $tce = t3lib_div::makeInstance('t3lib_TCEmain');
>>>> $tce->stripslashes_values=0;
>>>> $cmd['pages'][551]['copy'] = 1822;
>>>> $tce->start(array(),$cmd);
>>>> $tce->process_cmdmap();
>>>> t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
>>>>
>>>> $id = $GLOBALS['TYPO3_DB']->sql_insert_id();
>>>> echo $id ;
>>>>
>>>> A copy of page 551 is successfully made. But $id is 0. But how do I
>>>> get the id of the copy?
>> --
>> Xavier Perseguers
>> http://xavier.perseguers.ch/en
>
>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>
More information about the TYPO3-english
mailing list