[TYPO3] Is there a copy row or dulpicate row function?

Sander van Gelderen reply at to.list
Fri Jun 8 17:04:36 CEST 2007


Hi Anders,

I have also *finally* found the solutiuon to my problem, just posted it 
on the list, have a look it might be of use to you. After reading your 
post I immediately created a normal user to check if I have the same pb 
as you with authentication. The answer is: no difference between 
admin/normal user with my approach.

share and enjoy!

Sander

Anders Tillbeck schreef:
> I took a while. At first it did not work since the be_user I was logged 
> in as did not have the neccesary rights. I found out when trying to 
> execute my code as admin and that worked :-)
> 
> I may end up having to use this to execute code as admin using:
> $tce->start($data,$cmd,$alternative_BE_USER);
> 
> 
> But for now my working example is to do something like this:
> 
> class tx_myextension_pi1 extends tslib_pibase {
>     ... ...
>     function main($content,$conf)    {
>         $uid = 56; // uid of tt_content that shall be copied
>         $to_page_id = 7; // where to place copy of tt_content
>         if($this->copy_tt_content($uid,$to_page_id)) {
>         $content .= 'ok to insert new tt_content<br />';
>         }
>     }
> 
>     // Insert new tt_content
>     function copy_tt_content($uid,$to_page_id) {
>         require_once (PATH_t3lib.'class.t3lib_tcemain.php');
>         $tce = t3lib_div::makeInstance('t3lib_TCEmain');
>         $tce->stripslashes_values=0;
>         $data['cmd']['tt_content'][$uid]['copy']=$to_page_id;
>         $tce->start($data['data'],$data['cmd']);
>         $tce->process_datamap();
>         $tce->process_cmdmap();
>         return true;
>     }
>     ... ...
> }
> 
> 
> But now I ended up with a different problem. The tt_content that is 
> inserted into $to_page_iud is inserted as a "non-used element". For now 
> I have to go back into the page module and insert the newly created 
> "non-used element" into the page.
> 
> BR. Anders


More information about the TYPO3-english mailing list