Discussion:
[Typo3] Simple Menu problem?
Eric Auchterberger
2005-02-11 20:17:06 UTC
Permalink
Hi list,
I have a site on (typo3 3.7) it have a page structure and a menu
(TMENU) that reflects it on the FE.
What I need and can`t do for now was to make some pages (any that I
want) to apear in the menu but don`t link it. What I already try was
to make this pages of type SPACER and set its to doNotLinkIt = 1 but
the problem is that the subpages of the SPACER are not showed on the
menu.

This is an example, I want to unlik option2 bsubmenu option1.0 and option1.1.
(Not care if option2 is ACTIVE or not , I just want to unlink
selected pages on the menu. )

Option0
option0.0
option0.1

Option1
option1.0
option1.1

Option2
option2.0
option2.1

Thanks in advance for you reading and any sugestion.
I know and have read the calssics docs. TSref, TSbyexample, etc. and
not found howto resolve this.ut show it on the menu and also show its
submenu option1.0 and option1.1. Not care if it is ACTIVE, just I
want to unlink selected pages on the menu.

Option0
option0.0
option0.1

Option1
option1.0
option1.1

Option2
option2.0
option2.1

Thanks in advance for you reading and any sugestion.
I know and have read the calssics docs. TSref, TSbyexample, etc. and
not found howto resolve this.

Eric
Georg Rehfeld
2005-02-12 15:04:53 UTC
Permalink
Hi,
Post by Eric Auchterberger
This is an example, I want to unlik option2 bsubmenu option1.0 and option1.1.
(Not care if option2 is ACTIVE or not , I just want to unlink
selected pages on the menu. )
Option0
option0.0
option0.1
Option1
option1.0
option1.1
Option2
option2.0
option2.1
I think you need an itmArrayProcFunc for this, setting the menu
state to USERDEF2 and formatting USERDEF2 differently.

Your Typoscript must look similar to this:

----------
// include our script/class, see below
includeLibs.curifsub = fileadmin/script/curifsub.inc
...
lib.menu1 {
// the menu object itself, starting off the site root
10 = HMENU
10.entryLevel = 0
...
10.1 = TMENU
10.1 {
// to hide some top level entries, but have the children
// still visible, else children would be not accessible
expAll = 1

// special processing with our script/class
itemArrayProcFunc = user_itemArrayProcFunc->markList

// here you configure the page IDs, that shall get the
// USERDEF2 state, comma separated, no spaces!!!
itemArrayProcFunc.specialUidList = 51,61

// enable config/processing for USERDEF2
USERDEF2 = 1
USERDEF2 {
// unlink these
doNotLinkIt = 1

// other formatting to your liking
...
}

// other states here ...
CUR = 1
...
}
...
}
----------

Then have the following in fileadmin/script/curifsub.inc

----------
<?php

class user_itemArrayProcFunc {

function curifsub($menuArr, $conf) {
// Enable the USERDEF1 menustate as a replacement for the
//missing CURIFSUB menustate.
// Usage: In your TMENU/GMENU object insert this line:
// itemArrayProcFunc = user_itemArrayProcFunc->curifsub
while(list($k, $v) = each($menuArr)) {
if ($conf['parentObj']->isItemState('IFSUB', $k) &&
$conf['parentObj']->isItemState('CUR', $k))
{
$menuArr[$k]['ITEM_STATE'] = 'USERDEF1';
}
}
return $menuArr;
}

/**
* A method setting the ITEM_STATE to USERDEF2, when the uid of the
* item is in a configured list. These menu items can then be
* processed differently, e.g. they might get unlinked via TS.
*
* @param array The $menuArr array which is a num-array of page
* records which go into the menu.
* @param array TypoScript configuration for the function.
* Notice that the property "parentObj" is a
* reference to the parent (calling) object (the
* tslib_Xmenu class instantiated)
* @return array The modified $menuArr array
*/
function markList($menuArr, $conf) {
$specialUids = array();
if ($conf['specialUidList']) {
$specialUids = explode(',', $conf['specialUidList']);
}
while(list($k, $v) = each($menuArr)) {
if (in_array($menuArr[$k]['uid'], $specialUids)) {
$menuArr[$k]['ITEM_STATE'] = 'USERDEF2';
}
}
return $menuArr;
}

/**
* A method setting the ITEM_STATE to USERDEF2, when the uid of the
* item is in a configured list. These menu items can then be
* processed differently, e.g. they might get unlinked via TS. Also
* adds the missing CURIFSUB state as USERDEF1, when not USERDEF2.
*
* @param array The $menuArr array which is a num-array of page
* records which go into the menu.
* @param array TypoScript configuration for the function.
* Notice that the property "parentObj" is a
* reference to the parent (calling) object (the
* tslib_Xmenu class instantiated)
* @return array The modified $menuArr array
*/
function markListAndCurifsub($menuArr, $conf) {
$specialUids = array();
if ($conf['specialUidList']) {
$specialUids = explode(',', $conf['specialUidList']);
}
while(list($k, $v) = each($menuArr)) {
if (in_array($menuArr[$k]['uid'], $specialUids)) {
$menuArr[$k]['ITEM_STATE'] = 'USERDEF2';
}
else if ($conf['parentObj']->isItemState('IFSUB', $k) &&
$conf['parentObj']->isItemState('CUR', $k))
{
$menuArr[$k]['ITEM_STATE'] = 'USERDEF1';
}
}
return $menuArr;
}
}

?>
----------

This should do what you want.

regards, Georg
--
___ ___
| + | |__ Georg Rehfeld Woltmanstr. 12 20097 Hamburg
|_|_\ |___ georg.rehfeld.nospam at gmx.de +49 (40) 23 53 27 10
Georg Rehfeld
2005-02-16 04:04:19 UTC
Permalink
something, taking me hours.
I'm in the mood to cancel valuable responses I wrote and receiving no
notice at all.

This message is intended to just test, if my news reader actually
cancels my message really
a) from the news system
b) from typo3.org

Note, that I'll not stop to post verbose and poor answers from time
to time.

But subjects nobody reacts to (beside some valuable answer), are
obviously of no interest to anyboy, so they _should_ be dropped,
to not clutter the already very long list of questions.

Loading...