[TYPO3-english] userdefined menu ACT state

Stephan de Bruin stephan.de.bruin at dpdk.nl
Wed Jul 7 16:44:31 CEST 2010


Hello,

I've got a small question about a userdefined menu. I don't seem to be 
able to get it to have an active state. (I'm using rgaccordion-menu for 
visualisation, but this shouldnt have any impact on the code)

Below i've posted my typoscript and my php-code that fills the menu.

Thanks in advance for your help.
Kind regards,
Stephan

==========
TYPOSCRIPT
==========
lib.cl_menu = HMENU
lib.cl_menu.special = userdefined
lib.cl_menu.special.file = fileadmin/scripts/clMenu.php
lib.cl_menu.special.uid = 125
lib.cl_menu.special.pid = 2
lib.cl_menu.special.text {
   topics = Topics
   regions = Regions
   targets = Target groups
}

lib.cl_menu {
     1 = TMENU
     1 {
         wrap = <ul id="rgaccordmenu">|</ul>
         noBlur = 1
         expAll = 0
         NO >
         NO.wrapItemAndSub = <li class="topics">|</li> |*| <li 
class="regions">|</li> |*| <li class="targets">|</li>
         NO.linkWrap = <span class="toggle">|</span>
         IFSUB <.NO
         IFSUB.linkWrap = <span class="toggle topics" 
onmouseover="this.className='toggle topicsOver'" 
onmouseout="this.className='toggle topics'">|</span> |*| <span 
class="toggle regions" onmouseover="this.className='toggle regionsOver'" 
onmouseout="this.className='toggle regions'">|</span> |*| <span 
class="toggle targets" onmouseover="this.className='toggle targetsOver'" 
onmouseout="this.className='toggle targets'">|</span>
         IFSUB.doNotLinkIt = 1
         ACTIFSUB <.NO
         ACTIFSUB.linkWrap = <span class="open toggle">|</span>
     }
     2 = TMENU
     2 {
	wrap = <ul class="content">|</ul>
	NO.wrapItemAndSub = <li class="secondlevel">|</li>
	NO.linkWrap >
	IFSUB >
	IFSUB.linkWrap = <span class="toggle2">|</span>
	ACTIFSUB.linkWrap = <span class="open toggle2">|</span>
        	ACT < .NO
        	ACT {
       	   wrapItemAndSub = <li class="current">|</li>
        	}
     }
}

==========
  PHP CODE
==========
<?php
//$cats[] = array('title' => $row['title'], 'uid' => $shopUid . 
'&cat_id=' . $row['uid'], 'ITEM_STATE' => 'ACT', '_SUB_MENU' => 
get_categories($pid, $shopUid, $row['uid'], $open));
//$cats[] = array('title' => $row['title'], 'uid' => $shopUid . 
'&cat_id=' . $row['uid'], 'ITEM_STATE' => 'NO');

$menu = array();
$menu[0] = array('title' => $conf['text.']['topics'], 'uid' => '', 
'ITEM_STATE' => 'NO', '_SUB_MENU' => array());
$menu[1] = array('title' => $conf['text.']['regions'], 'uid' => '', 
'ITEM_STATE' => 'NO', '_SUB_MENU' => array());
$menu[2] = array('title' => $conf['text.']['targets'], 'uid' => '', 
'ITEM_STATE' => 'NO', '_SUB_MENU' => array());

/* TOPICS */
$topic_rs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
     "*",
     "tx_topic",
     "pid = " . $GLOBALS['TYPO3_DB']->fullQuoteStr($conf['pid'], 
'tx_topic') . $GLOBALS['TSFE']->cObj->enableFields('tx_topic'),
     "",
     "name"
);

foreach ($topic_rs as $topic) {
	
	if ( isset($_GET['L']) && $_GET['L'] == 1 && $topic['name_ru'] != '' )
		$topic['name'] = $topic['name_ru'];

     $menu[0]['_SUB_MENU'][] = array('title' => $topic['name'], 'uid' => 
$conf['uid'], '_ADD_GETVARS' => 
'&tx_wi_pi1[search]=1&tx_wi_pi1[search_topic]=' . 
urlencode($topic['uid']), 'ITEM_STATE' => 'NO');
}

/* REGIONS */
$region_rs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
     "*",
     "tx_region",
     "pid = " . $GLOBALS['TYPO3_DB']->fullQuoteStr($conf['pid'], 
'tx_region') . $GLOBALS['TSFE']->cObj->enableFields('tx_region'),
     "",
     "name"
);
foreach ($region_rs as $region) {

	if ( isset($_GET['L']) && $_GET['L'] == 1 && $region['name_ru'] != '' )
		$region['name'] = $region['name_ru'];

     $menu[1]['_SUB_MENU'][] = array('title' => $region['name'], 'uid' 
=> $conf['uid'], '_ADD_GETVARS' => 
'&tx_wi_pi1[search]=1&tx_wi_pi1[search_region]=' . 
urlencode($region['uid']), 'ITEM_STATE' => 'NO');
}

/* TARGETS */
$target_rs = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
     "*",
     "tx_target",
     "pid = " . $GLOBALS['TYPO3_DB']->fullQuoteStr($conf['pid'], 
'tx_target') . $GLOBALS['TSFE']->cObj->enableFields('tx_target'),
     "",
     "name"
);
foreach ($target_rs as $target) {

	if ( isset($_GET['L']) && $_GET['L'] == 1 && $target['name_ru'] != '' )
		$target['name'] = $target['name_ru'];

     $menu[2]['_SUB_MENU'][] = array('title' => $target['name'], 'uid' 
=> $conf['uid'], '_ADD_GETVARS' => 
'&tx_wi_pi1[search]=1&tx_wi_pi1[search_target]=' . 
urlencode($target['uid']), 'ITEM_STATE' => 'ACT');
}

$menuItemsArray = $menu;
?>


More information about the TYPO3-english mailing list