[TYPO3-dev] HMENU based on table from a extbase extension
Benjamin Beck
BenjaminBeck at gmx.de
Tue Aug 23 16:41:16 CEST 2011
Hello all,
i want to make a Navigation based an a table from a extbase extension.
Until now i have this as Typoscript:
--------------------------------------------------------------------------
lib.contentmenu = HMENU
lib.contentmenu {
special = userfunction
special.userFunc = user_menuFunc->makeMenuArray
special.userFunc.table = tx_gldataobjects_domain_model_kompetenzfeld
special.userFunc.select.pidInList = 11
special.userFunc.select.languageField = sys_language_uid
1 = TMENU
1 {
expAll = 1
doNotLinkIt = 1
stdWrap.field = name
NO.wrapItemAndSub = <li>|</li>
ACT < .NO
}
2 < .1
3 < .2
4 < .2
}
--------------------------------------------------------------------------
and this as PHP:
--------------------------------------------------------------------------
class user_menuFunc {
function makeMenuArray($content,$conf) {
$menuArr = array();
$lConf = $conf["userFunc."];
$res = $this->cObj->exec_getQuery($lConf["table"],$lConf["select."]);
if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
} else {
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$menuArr[] = $row;
}
}
echo "<pre>";
print_r($menuArr);
echo "</pre>";
return $menuArr;
}
}
--------------------------------------------------------------------------
PRINT_R produces the expected result: a nummeric array with all table elements from the right language (sys_language_uid=0).
But in when i render the variable in the template, there is only the last array entry left.
So i think the error is in the TypoScript, but i´m still really bad in TS.
Does anyone see the error?
btw.: i would like to later integrate this menu into the main menu. any ideas how to do this?
Thanks
Benjamin
More information about the TYPO3-dev
mailing list