Results 1 to 6 of 6

Thread: Navigation images

  1. #1
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Navigation images

    I need each navigation item to have an image that can be uploaded and assigned to each page. I do realize that this is a bit difficult having an unknown number of navigation modules. But is there a way that I have missed? ops:

    Right now I am going to edit a nav template to include an image that has the exact name of the page. My client will have to name images exactly right for it to work... :?

  2. #2
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: Navigation images

    Seems a good way to go. You could also assign the images using CSS, but that would not save you (or your client) from creating and renaming the images.

  3. #3
    Experienced user
    Join Date
    08-21-09.
    Posts
    563

    Default Re: Navigation images

    I did see a couple of extensions that let you assign an image on a per-page basis. I managed to dig them up --
    http://www.typolight.org/extension-list ... 09.en.html
    http://www.typolight.org/extension-list ... 19.en.html

    Having not tried either, I don't know if they can be adapted to something that would help you -- I guess it depends if you can get to the image data from a nav module.

    There's also this one, which sounds closest to what you need, but its Alpha and looks to only be in German --
    http://www.typolight.org/erweiterungsli ... 00.de.html
    Brian

  4. #4
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: Navigation images

    I'll go and try my idea. Since Leo seems to think this is a good idea I'm pretty confident there is no real other solution. CSS would be a bit more difficult because the client needs to change CSS for that rather then just uploading a correctly named image.

    Medianomaly: I'm using an adjusted version of the first extension, the second seems to do the same. The problem is that they use modules to display the image for the current page only so neither will work in their current form for what I need in this case. Thanks though!

  5. #5
    User
    Join Date
    02-01-10.
    Posts
    111

    Default Re: Navigation images

    Vera, I wonder how this turned out for you? I have a need to display an image next a main category menu item and would be interested in learning from your experience.

  6. #6
    User
    Join Date
    04-27-10.
    Posts
    134

    Default Re: Navigation images

    Quote Originally Posted by tmikk
    Vera, I wonder how this turned out for you? I have a need to display an image next a main category menu item and would be interested in learning from your experience.
    I think I know what you mean.
    To my knowledge there would be 2 options.
    1. CSS :after
    If you categories have a css class, you could always use the element:after like..
    Code:
    h1:after {content:url(smiley.gif);}
    but if you have a lot of categories this may not be the best option due to amount of css code required.

    2. Edit the template. Like Vera has mentioned, having images the same name as the category would be the way to go.
    Edit a custom Nav template and where it displays
    Code:
    <?php echo $item['link'] ?>
    change it for something like
    Code:
    <?php echo $item['link'] ?> [img]tl_files/website/<?php echo $item['link'] ?>.jpg[/img]
    Name all the images the same as the category name and that should sort you out.
    You could place the image after the closing </a> if you didn't want it to be part of the link.

    BTW. I haven't tested this with submenu items

    I'm using a similar method for a menu made up of images.
    Hope that helps and covers what you wanted.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •