[TYPO3] Re: [Typo3] HMENU with static images

Tim Riemenschneider lists-05 at tim-riemenschneider.de
Wed Feb 22 13:55:18 CET 2006


Rickard Andersson schrieb:
> I have a very simple menu:
> 
> temp.MAIN_MENU = HMENU
> temp.MAIN_MENU.1 = TMENU
> temp.MAIN_MENU.1 {
>   noBlur = 1
>   NO.allWrap = <div class="menuItem">|</div>
> }
> 
> Now, instead of displaying text links, I want to use some ready-made 
> PNGs. Instead of outputting links like this:
> 
> <a href="index.php?id=55">Name_of_page</a>
> 
> I want e.g:
> 
> <a href="index.php?id=55"><img src="55.png" alt="" /></a>
> 
> or maybe
> 
> <a href="index.php?id=55"><img src="Name_of_page.png" alt="" /></a>
> 
> I've scoured the net for an answer to this, but I can't seem to find it. 
> This somewhat troubles me since what I want to do must be extremely 
> common. I've had a look at GMENU, but it appears to be useful only if 
> you, for some odd reason, want to generate the images dynamically. I 
> have static images that cannot be generated by Typo3 (varying 
> backgrounds, unusual fonts etc). Any help on the matter (apart from a 
> link to tsref) would be greatly appreciated.

Well, the email is quite old, but I will answer anyway (have just found 
this mail while searching for sth else)
The GMENU has a useful property named altImgResource.
A menu an a site I have done:
--------------
# The menu:
temp.menu = HMENU
temp.menu.1 = GMENU

temp.menu.1.NO {
   altImgResource.import = uploads/media/
   altImgResource.import.field = media
   altImgResource.import.listNum = 0
   # wrap
   wrap = |<br />

   # fall back GIFBUILDER item, if no result from altImgResource:
   XY = [4.w], [4.h]
   backColor = silver

   4 = IMAGE
   4.file = fileadmin/template/images/button.gif
   10 = TEXT
   10.text.field = nav_title // title
   10.offset = 30,19
   10.fontSize= 11
   10.fontColor = white
}
temp.menu.1.RO < temp.menu.1.NO
temp.menu.1.RO = 1

temp.menu.1.RO.altImgResource.import.listNum = 1
temp.menu.1.RO {
  4.file = fileadmin/template/images/button_over.gif
}

temp.menu.1.CUR < temp.menu.1.NO
temp.menu.1.CUR = 1
temp.menu.1.CUR.altImgResource.import.listNum = 2
temp.menu.1.CUR {
   4.file = fileadmin/template/images/button_active.gif
   10.fontColor = #5271a1
}
----------
than you can just attach 3 files to the page-record (type set to 
Advanced), which will than be used for the three menu-states.
If no image is attached, the menu will fall back to generated images.

cu
   Tim



More information about the TYPO3-english mailing list