[Typo3-dev] Change in class.tslib_menu.php

Tapio Markula tapio.markula at dnainternet.net
Fri May 13 08:53:31 CEST 2005


Hi Agner				

...[write your message here]...

Someone has added also 'USERDEF1'.

The menu php-file has 

switch($kind)	{
				case 'SPC':
					$natVal = $this->menuArr[$key]['isSpacer'];
				break;
'SPC'  comes from the 'doktype' field from the page menu.

It would be nice if, there could be also in the core file

'EXTURL' - and 'SHORTCUT', which are at the SAME
way  page types like 'SPC'..

How difficult/easy it would be add them?

I tried to make for them USERDEF1:

function specialLinks($menuArr,$conf)    {
        // Usage: In your TMENU/GMENU object insert this line:
        // itemArrayProcFunc = user_itemArrayProcFunc->specialLinks
        while(list($k,$v)=each($menuArr))    {
            if ($menuArr[$k]['doctype']==3 || 
            $menuArr[$k]['doctype']==4) 
            $menuArr[$k]["ITEM_STATE"]="USERDEF1"; 
        }
        return $menuArr;
    }
 
But that function doesn't do anything - I tested with another function.
and USERDEF1 itself worked fine (I tested with fake manu items from the 
example file).  For all possible pages types, which can be used in the navigation should be
easily  set link states..

I got this  fro a listmember  

There's no need to define the USERDEF states if thats all you 
want to do, as it can be done using pure TypoScript  :) 

Take a look at this example code:
-- cut --
temp.doktypeMenu = HMENU
temp.doktypeMenu.entryLevel = 1
temp.doktypeMenu.1 = TMENU
temp.doktypeMenu.1 {
  NO {
    stdWrap.cObject = CASE
    stdWrap.cObject {
      key.field = doktype
      default = COA
      default {
        10 = TEXT
        10.field = title
        10.wrap = |
 
      }
      # External URL
      3 = TEXT
      # Shortcut Pages
      4 = TEXT
    }
    allWrap = |
  }
}
-- cut --
 
What it does is using the CASE object inside the menu object, and 
create different renderings for each doktype.
 
"default" is everything not specific defined.
"3" is the External URLs
"4" is the Shortcut Pages
 
And since "3" & "4" is defined to show nothing, they menulinks won't 
show up on the menu.

I did corresponding script


temp.colSitemap.2 = TMENU
temp.colSitemap.2 {
expAll=1

  # Normal state properties

  NO {
      allWrap = <div class="csc-sitemap csc-sitemap-level2"> | </div>
      linkWrap=|
      stdWrap.cObject = CASE
      stdWrap.cObject {
      key.field = doktype
      default = COA
      default {
        10 = TEXT
        10.field = title
        10.wrap = <span>&nbsp;&#8226;&nbsp;|</span>
      }
      # External URL
      3 = TEXT
      # Shortcut Pages
      4 = TEXT  
  }
}

BUT the problem was that  SUBPAGES disappered - third and fourth level menus didn't work,
when I defined the CASE for the second level.
The code worked just in one level. The system could be much easier tha usein USERDEF1 etc.



- Tapio Markula (tmarkula)

-----------------------
This thread is located in the archive at this URL:
http://typo3.org/documentation/mailing-lists/dev-list-archive/thread/51952/
					




More information about the TYPO3-dev mailing list