[TYPO3-english] Copy page in fe plugin

Iban Cardona i Subiela icardona at serialnet.net
Wed Feb 24 20:39:10 CET 2010


Hello,

I want to copy in recursive-mode a typo3 page in an other page.
In my my fe plugin, I implemented this code but it only copy the page 
and the contents. The "title", "doktype" and "tx_templavoila_flex 
<http://proves.serialnet.net/phpmyadmin/sql.php?db=typo42&table=pages&sql_query=SELECT+%2A+FROM+%60pages%60+ORDER+BY+%60pages%60.%60tx_templavoila_flex%60+ASC&token=3845a719b645b3ec92950bb9b04d5476>" 
are not copied. Could you help me? Thank you so much.

$new_BE_USER = t3lib_div::makeInstance("t3lib_beUserAuth");
$new_BE_USER->OS = TYPO3_OS;
$new_BE_USER->setBeUserByUid($this->uid_userAdmin_be);
$new_BE_USER->fetchGroupData();
$root_page_pid = $this->copyDummyPages($id_old_page, $new_BE_USER, 
$folder_news_page);

function copyDummyPages($src_uid, $new_BE_USER, $dest_uid) {
         $this->tce = t3lib_div::makeInstance("t3lib_TCEmain");
         $this->tce->stripslashes_values = 0;
         $this->tce->copyTree = 10;
         $this->tce->neverHideAtCopy = 1;

         // setting the user to admin rights temporarily during copy. 
The reason is that everything must be copied fully!
         $new_BE_USER->user["admin"] = 1;

         // making copy-command
         $cmd = array();
         $cmd["pages"][$src_uid]["copy"] = $dest_uid;
         $this->tce->start(array(),$cmd,$new_BE_USER);
         $this->tce->process_cmdmap();

         // getting the new root page id.
         $this->tce->clear_cacheCmd("temp_CACHED");
         $root_page_pid = $this->tce->copyMappingArray["pages"][$src_uid];

         // unsetting the user.
         unset($new_BE_USER);

         return $root_page_pid;
     }

-- 
Serialnet SL

*  IBAN CARDONA I SUBIELA*
   SERIALNET NETWORKING I SOFTWARE LLIURE SL
   c/Bailèn, 71Bis 5è 3a
   08009 - Barcelona
   Tel. 93 265 09 37
http://www.serialnet.cat
LINKEDIN:http://www.linkedin.com/in/icsbcn 
<http://www.linkedin.com/in/icsbcn>

------------------------------------------------------------------------


More information about the TYPO3-english mailing list