[TYPO3] Which API call to programatically copy a page?
Dmitry Dulepov [typo3]
dmitry at typo3.org
Sat Aug 9 07:53:27 CEST 2008
Hi!
Mike wrote:
> Is there an api call to copy a page? Without having to manually copy
> individual records in the db ( which I'm assuming would be more than
> just the page table, because others are relationally connected).
>
> I don't want a reference or "shortcut" or whatever it's called, I just
> want to make a copy of a page, and put that copy elsewhere in the page
> tree. With an api call, in a backend module.
>
> I'm not finding this in the api so far, but the auto generated docs
> really are HUGE...
require_once(PATH_t3lib . 'class.t3lib_tcemain.php');
$cmdmap = array(
'pages' => array(
$your_page_id => array(
'copy' => $destinationPid,
),
),
);
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->start(false, cmdmap);
$tce->process_cmdmap();
if (count($tce->errorLog) > 0) {
// Handle error here
}
$destinationPid can be either positive, which means "insert as the last subpage of this page" or negative, which means "insert on the same level after the page with uid=abs($destinationPid)".
--
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/post-details/typo3_code_formatting_in_eclipse/
More information about the TYPO3-english
mailing list