[TYPO3] separate image for each menu item

Christopher Torgalson bedlamhotel at gmail.com
Tue Apr 15 08:23:57 CEST 2008


Hi,

On Tue, Apr 15, 2008 at 7:47 AM, Xavier Perseguers <typo3 at perseguers.ch> wrote:
> Hi David,
>
>  > I would like to place a different image with each menu item.
>  > Wondering if anyone has a simple way to do this.
>
>  About a year ago I did this for a menu where I wanted to show a small
>  picture related to the destination page. I did this:
>
>      subparts.SUBMENU = HMENU
>      subparts.SUBMENU.entryLevel = 1
>      subparts.SUBMENU.1 = TMENU
>      subparts.SUBMENU.1 {
>          noBlur = 1
>          NO {
>              stdWrap.dataWrap (
>                <img src="/fileadmin/images/submenu/{field:uid}.gif"
>  alt="" width="62" height="40" />
>                <span class="title">|</span><br />
>                <span class="description">{field:subtitle}</span>
>              )
>              ATagParams = class="submenu"
>          }
>      }
>
>  Thus with this configuration the image has to be named according to the
>  page id of the destination, that is fileadmin/images/submenu/12.gif for
>  page id #12.


This is a bit ugly, as it doesn't allow the image to be handled inside
TYPO3. There are two other methods (which you'll have to research,
because I can only outline them at the moment):

1. As above, but use {field:uid} to construct an id attribute for each
menu item and use CSS to place the images (note that id attributes may
not start with a number, so you'll have to do something like
id="menu_{field:uid}")

2. Use the 'media' field in the page record to store specific images
per page and construct the menu so that it refers to these images
(search around; this method has appeared on the lists and other
websites dozens of times)


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


More information about the TYPO3-english mailing list