[TYPO3-dev] set TCA from page doctype ...?
Stefan Kreisberg
stefanNOSPAM at linkfactory.dk
Mon Jun 12 14:58:49 CEST 2006
Stefan Kreisberg wrote:
> Hi,
>
> It's probably been asked before - is there any way that I can dynamicly
> change the TCA based on a page doctype?
>
> I welcome all hints and pointers to docs I should've read ;-)
>
> Cheers, Stefan a.k.a. Strato
Found a 'hack' to accomplish this, if anyone know of a reason NOT to do
this / a better way to do this, please let me know ...
$page_types=array(1,2,3,4);
$arr=t3lib_div::_GP('edit');
if(count($arr)) {
$s=array_keys($arr['tt_news']);
$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery('doktype','pages','
uid='.intval($s[0]));
list($doktype)=$GLOBALS['TYPO3_DB']->sql_fetch_row($res);
if(in_array($doktype,$page_types)) {
$TCA['tt_news']['columns']['type']['config']['default']=$doktype;
/* Setting user TS config also works, but page TS config doesn't however ..
(?) */
//t3lib_extMgm::addUserTSConfig('
// TCAdefaults.tt_news.type = '.$doktype.'
//');
}
} else ....
This way I can create new pages where content in TCEFORMS is rendered
according to the page doktype ;-)
Happy hunting :-)
-Strato a.k.a. Stefan Kreisberg
More information about the TYPO3-dev
mailing list