[TYPO3] TMENU - gifbuilder

Christopher Torgalson bedlamhotel at gmail.com
Wed Aug 1 16:46:53 CEST 2007


Hi,

On 7/31/07, Patrik <paprikb at gmail.com> wrote:
> I have a problem about the TMENU, which has an image (before of text), is
> generated with GIFBUILDER.
> The image must have a class ("imgmenu"). How add a class in typoscript of
> the menu?
>
> Code:
> 1 = TMENU
>     1 {
>         NO.allWrap = <div class="nofloat">|</div>
>         NO {
>             beforeImg = GIFBUILDER
>             beforeImg {
>                 #params = class="imgmenu"
>                 XY = 7,22
>
>                     10 = IMAGE
>                     10.file = GIFBUILDER
>                     10.file {
>                         #params = class="imgmenu"
>                         XY = 7,22
>                         backColor.data = field:uid
>                         backColor.preUserFunc =
> tx_fmcolormenue_pi1->getColor
>                     }
>             }
>             ATagParams = class="linktext"
>             stdWrap.case = upper
>         }
>
>         ACT < .NO
>         ACT = 1
>     }


It's pretty easy: the IMAGE cObject has a property called 'params'
[1], so you can just add this:

10.params = class="imgmenu"

It didn't work where you placed it because the GIFBUILDER object has
no such property (check in the TSref!)

On the other hand, it's probably unnecessary--any time you end up with
number of nearly identical HTML elements inside the same parent
element, each with the same class in your code, it's almost always a
sign that you should be using descendent selectors [2] in your css. If
your TMENU or HMENU has a parent container, put an id into it and
write the the css this way:

/* Assuming the menu is wrapped with <div id="menu">|</div> */
#menu .nofloat img {
  /* Here goes the code that used to be in .imgmenu */
}



-- 
Christopher Torgalson
http://www.typo3apprentice.com/

[1] http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/8/6/
[2] http://www.w3.org/TR/REC-CSS2/selector.html#descendant-selectors


More information about the TYPO3-english mailing list