[Typo3] Current menu item on top (first in the list)
Peter Klein
peter at umloud.dk
Fri Sep 16 09:33:22 CEST 2005
Hi Cyprian . Here's a different approch, using a small itemArrayProcFunc
function.
Create a file named "menuFunc.inc" in your fileadmin dir, and copy/paste
this content into the file.
-- cut --
<?
class user_itemArrayProcFunc {
// Move menu item with ACT state, to the beginning of menuarray
//
// Usage in menu:
// itemArrayProcFunc = user_itemArrayProcFunc->actStateFirst
//
function actStateFirst($menuArr,$conf) {
$new_menuArr = array();
while(list($k,$v)=each($menuArr)) {
if ($conf["parentObj"]->isItemState("ACT",$k) ) {
// If the menu is in one of the ACT states (ACT, ACTIFSUB + RO),
// then we place it at the BEGINNING af the new menuarray
array_unshift($new_menuArr,$menuArr[$k]);
}
else {
// Otherwise we just place it at the END of the new menuarray
array_push($new_menuArr,$menuArr[$k]);
}
}
return $new_menuArr;
}
}
?>
-- cut --
Then in the top of your SETUP field , add a line like this:
-- cut --
includeLibs.MenuFunc = fileadmin/menuFunc.inc
-- cut --
And in your TMENU/GMENU add this line (Check TSREF for the placement in the
menu structure):
-- cut --
itemArrayProcFunc = user_itemArrayProcFunc->actStateFirst
-- cut --
I have only tested it using a TMENU, so let me know if it works using
TMENU_LAYERS/GMENU_LAYERS as well.
--
Peter Klein/Umloud Untd
>> Try something like this:
>>
>> http://www.4any1.de/fileadmin/li_positioning.html
>>
>> Joey
>
> :) thanks for the answer, yet it's not that simple :)
> Please notice that I would like to have 'Test 3' item in the place where
> 'Test 1' item is, and the rest of the menu moved down respectively.
> Moreover 'Test 3' can have some subitems and then you'd have to use some
> JavaScript to move the rest of the menu down.
> I don't think it's possible with pure CSS.
>
>
> --
> best regards, Cyprian
More information about the TYPO3-english
mailing list