[Typo3] How to query the number (in list) of a menu item
Peter Klein
peter at umloud.dk
Thu Nov 3 17:00:35 CET 2005
Hi Alexander, why doesn't you use a GMENU_LAYERS type of menu?
You can then set the "displayActiveOnLoad" property to force display of the
subnav layer.
That way you can get the subitems to align with the mainitem.
--
Peter Klein/Umloud Untd
"Alexander Heidl" <aheidl at fulcio.co.uk> skrev i en meddelelse
news:mailman.9016.1130944909.10463.typo3-english at lists.netfielders.de...
> Hello List,
>
> I am trying to approch a two column menu where the right column shows the
> subsequent menu and the left column the right menu:
>
> +----------+----------+
> | mainnav | subnav |
> +----------+----------+
>
> For both menus I use GMENU which works absolutely like a charm for me up
> to
> a certain point. Both menus are generated within its column, though both
> aligned at the top of their tag:
>
> +----------+----------+
> | TopicA | TopicA.1 |
> | Topic2 | TopicA.2 |
> | Topic3 | |
> +----------+----------+
>
> "TopicA" indicates the active topic.
>
> Now when I change the topic to a different then the first obviously the
> submenu is rendered and placed at the top edge of its tag as well:
>
> +----------+----------+
> | Topic1 | TopicA.1 |
> | TopicA | TopicA.2 |
> | Topic3 | |
> +----------+----------+
>
> Which in my poinion is not very nice. So I thought to myself, why not
> aligning the submenu items with the triggering parent menu item so it
> would
> look like:
>
> +----------+----------+
> | Topic1 | |
> | TopicA | TopicA.1 |
> | Topic3 | TopicA.2 |
> +----------+----------+
>
> Apparently this seems to be a far mor difficult task then I thought it to
> be. My idea was to query for the actual number in list of the parent menu,
> multiplicate this with the hight of the GMENU object and place this as an
> image block befor the submenu, so it creats the leading space for the
> alignment (shaded with ///):
>
> +----------+----------+
> | Topic1 | //////// |
> | TopicA | TopicA.1 |
> | Topic3 | TopicA.2 |
> +----------+----------+
>
> TopicA = 2nd in list so list numer = 2
>
> This means I have to place a leading space of one topic item height:
> /////// = [Topic.h]*listnumber-1
>
> Questions now are:
>
> 1. Is my thinking right or are there better approaches?
> 2. Is there a solution for that?
> 3. Or maybe some indication on where to look?
>
> Finally my raw menu code snippet:
>
> #
> ----------------------------------------------------------------------------
> -----
> # Main Menu
> #
> ----------------------------------------------------------------------------
> -----
> lib.mainnav = HMENU
> lib.mainnav.wrap = <table width="100%" border="0" cellspacing="0"
> cellpadding="0">|</table> lib.mainnav.entryLevel = 0
>
> lib.mainnav.1 = GMENU
> lib.mainnav.1 {
>
> # inactive
> NO {
> allWrap = <tr><td>|</td></tr>
> backColor = #FFFFFF
> XY = 150, 25
>
> 10 = IMAGE
> 10 {
> file.import = uploads/media/
> file.import.field = media
> file.import.listNum = 0
> align = center
> }
>
> 20 = TEXT
> 20 {
> niceText = 1
> align = left
> text.field = title
> #text.case = upper
> offset = 10,18
> spacing = 0
> fontFile = {$pathToFonts}arlrdbd.ttf
> fontSize = 16
> fontColor = #A2A2A2
> }
> }
>
> RO < .NO
> RO {
> 20.fontColor = #000000
> }
> RO = 1
>
> ACT < .NO
> ACT {
> 20.fontColor = #00529B
> }
> ACT = 1
> }
>
> #
> ----------------------------------------------------------------------------
> -----# Sub Menu #
> ----------------------------------------------------------------------------
> -----
> lib.subnav = HMENU
> lib.subnav.wrap = <table width="100%" border="0" cellspacing="0"
> cellpadding="0">|</table> lib.subnav.entryLevel = 1
>
> lib.subnav.1 = GMENU
> lib.subnav.1 {
>
> # inactive
> NO {
> allWrap = <tr><td>|</td></tr>
> backColor = #FFFFFF
> XY = 100, 20
>
> 10 = IMAGE
> 10 {
> file.import = uploads/media/
> file.import.field = media
> file.import.listNum = 0
> align = center
> }
>
> 20 = TEXT
> 20 {
> niceText = 1
> align = left
> text.field = title
> #text.case = upper
> offset = 10,18
> spacing = 0
> fontFile = {$pathToFonts}arlrdbd.ttf
> fontSize = 12
> fontColor = #A2A2A2
> }
> }
>
> RO < .NO
> RO {
> 20.fontColor = #000000
> }
> RO = 1
>
> ACT < .NO
> ACT {
> 20.fontColor = #00529B
> }
> ACT = 1
> }
>
> Environment: Typo3.8.0
>
>
More information about the TYPO3-english
mailing list