[TYPO3-core] RFC #6525: Feature: wrapItemAndSub for GMENU

Ernesto Baschny [cron IT] ernst at cron-it.de
Fri Sep 26 14:31:23 CEST 2008


This is an SVN patch request.

Type: New feature

Bugtracker references:
http://bugs.typo3.org/view.php?id=6525

Branches: trunk

Problem:
With a TMENU we have the wrapItemAndSub option, which wraps around the
current item but also all sub-items underneath. In GMENU there is no
such setting. But this can be handy in a couple of situations (see notes).

Solution:
Add support for .wrapItemAndSub in GMENU. The function is the exact copy
of the same function found in TMENU.

Notes:
In the era of accessibility the GMENU has gone unpopular in favor to
CSS-styled TMENUs. But the usage of stuff like GTMENU (see
http://wiki.typo3.org/index.php/GTMENU) makes a combination that might
make sense: You markup a menu with nested UL, LI and page titles, and
let TYPO3 render the GMENUs that will replace those titles with nice
graphics.

The problem here is that there are only hacks to be able to generate
valid XHTML nested lists with GMENUs.

How-to-reproduce:

Make your page render this GMENU:

lib.graphMenu = HMENU
lib.graphMenu {
	1 = GMENU
	1 {
		wrap = <ul>|</ul>
		NO {
			allWrap = <li>|</li>
			XY = [10.w]+5,18
			10 = TEXT
			10 {
				text.field = title
				fontColor = #000000
				fontFile = t3lib/fonts/vera.ttf
				fontSize = 12
				antiAlias = 1
				offset = 5,13
			}
		}
	}
	2 < .1
	3 < .1
	4 < .1
}

Result will be something like:

<ul>
  <li><img src="menu1" /></li>
  <li><img src="menu2" /></li>
  <ul>
    <li><img src="menu2.1" /></li>
    <li><img src="menu2.2" /></li>
  </ul>
</ul>

Notice the nesting of <ul>, which is not xhtml (you can only have <li>
under <ul>s!). Apply the patch and try this:

lib.graphMenu = HMENU
lib.graphMenu {
	1 = GMENU
	1 {
		wrap = <ul>|</ul>
		NO {
			allWrap = <li>|</li>
			XY = [10.w]+5,18
			10 = TEXT
			10 {
				text.field = title
				fontColor = #000000
				fontFile = t3lib/fonts/vera.ttf
				fontSize = 12
				antiAlias = 1
				offset = 5,13
			}
		}
		ACT < .NO
		ACT = 1
		ACT.allWrap >
		ACT.wrapItemAndSub = <li class="act">|</li>
	}
	2 < .1
	3 < .1
	4 < .1
}

Generates:

<ul>
  <li><img src="menu1" /></li>
  <li><img src="menu2" /></li>
  <li>
    <ul>
      <li><img src="menu2.1" /></li>
      <li><img src="menu2.2" /></li>
    </ul>
  </li>
</ul>

As it should be!

Cheers,
Ernesto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug-6525-GMENU-wrapItemAndSub.diff
Type: text/x-diff
Size: 958 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080926/0ab9f872/attachment.diff 


More information about the TYPO3-team-core mailing list