[TYPO3] $GLOBALS['TCA'] seems to be empty on static function call in FE-Extension
Johannes Konert
johanneskonert at gmx.de
Mon Jul 17 22:14:14 CEST 2006
Hello members,
it keeps me busy since a week:
I have a small extension manipulating the available pageTypes and
serving the registered pageTypes to interested callers.
One function returns all Ids of the available pageTypes by doing:
function submenugenerator() {
global $GLOBALS;
t3lib_div::loadTCA('pages');
foreach
($GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'] as
$item){
// search for doktype-keys and specific pagetypes and find
the page-uids in table 'pages' for them
}
return $pageIDsMenuArray;
}
I include this by TypoScript:
includeLibs.tx_myext = EXT:myext/class.tx_myext.php
temp.mymenu = HMENU
temp.mymenu {
..
special.value.preUserFunc = tx_myext->submenugenerator
special.if.isTrue.data.preUserFunc = tx_myext->submenugenerator
1=TMENU
..
}
So: This results in a nice menu in Frontend and works as it should, but
only if the ADMIN-User has a BE-Session at the same time. If the Admin
is not in the Backend, the foreach-Loop is not executing and giving a
PHP-warning: Warning: Invalid argument supplied for foreach() in ...
Why is $GLOBALS['TCA'] empty if my FE-Extension-Function is called by
TypoScript? (And why is it not empty if the Admin is in the BE the same
time?)
Thanks for any help how to get the $GLOBALS['TCA'] have some content in
all cirumstances and not just with the admin using the backend at the
same time..I do not want to click around in backend for the rest of my
life to make the menu work ;-)
Regards to all of you
Johannes
More information about the TYPO3-english
mailing list