


The HMENU type "special = updated" works fine, except that it shows pages that are subpages of hidden pages.
e.g.
- A --> visible
- B --> hidden
-- B.1 --> visible
-C --> visible
-- C.1 --> visible
So show B.1 is shown, even if B is hidden. The solution is a small userFunc. :)
Setting "itemArrayProcFunc.limit = 5" makes it work similar to setting "limit = 5" on the HMENU object.
NOTE: Changing the line:
if ($row['hidden']) {
Into:
if ($row['hidden'] || $row['nav_hide'] || $row['doktype']==5) {
This will also skip the menuitem if the "Hide in menu" checkbox is selected, or if the page type is "Not in menu"
The PHP script: (Save this as "fileadmin/menuFunc.inc")
-- cut --
<?php
class user_menuFunc {
function hideHiddenSubs($menuArr ,$conf) {
$this->pObj = $conf['parentObj'];
$limit = t3lib_div::intval_positive($conf['limit']);
$limit = $limit ? $limit : 9999;
$new_menuArr = array();
foreach ($menuArr as $pageFields) {
if (!$this->ishidden($pageFields['uid'])) {
$new_menuArr[] = $pageFields;
if (count($new_menuArr)==$limit) {
return $new_menuArr;
}
}
}
return $new_menuArr;
}
function ishidden($uid) {
$row['pid'] = $uid;
while ($row['pid']!=0 && $row['pid']!=$this->pObj->id) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','pages','uid='.$row['pid']);
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
if ($row['hidden']) {
return true;
}
}
return false;
}
}
?>
-- cut --
The Typoscript for my testmenu object:
-- cut --
page.includeLibs.newpages = fileadmin/menuFunc.inc lib.newpages = COA lib.newpages { wrap = <div style="border: 1px solid black;"> | </div> 10 = TEXT 10.value = New Pages 10.wrap = <div> | </div> 20 = HMENU 20.special = updated 20.special.value = 52 20.special { #mode = lastUpdated mode = tstamp depth = 99 maxAge = 3600*24*7*8 #limit = 5 } 20.1 = TMENU 20.1 { wrap = <ul> | </ul> expAll = 1 minItems = 1 maxItems = 5 itemArrayProcFunc = user_menuFunc->hideHiddenSubs itemArrayProcFunc.limit = 5 NO { allWrap = <li> | </li> } } } page.44 < lib.newpages -- cut -- - ERROR: Line 34: Object Name String, "--" was not preceded by any operator, =<>({;Line 71: Object Name String, "--" was not preceded by any operator, =<>({
This snippet was submitted by Peter Klein


Comments (0)