We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36582
    • 463 Posts
    I’m looking for a way to give each link in a menu a ’companion’ image that can be assigned at the time of page/menu item creation.

    I saw a thread a while back that used:

    &rowIdPrefix=`item`

    Can anybody expand on this as I don’t understand how this can then be applied. I understand that it will, in some way, allow me to assign a unique background image but I can’t work out how.

    I would prefer to know if it is possible to have a unique image sit at the side (left or right) of my link text?

    I’m a newbie and a mere designer so go easy!
      Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      If you add that to the snippet call, then each link will have an ID of "itemx" where x is a unique number (I forget exactly if it’s the document ID or what, but it will be unique). Then in your CSS file, style the links so they have enough padding on the end for the background image to show, then assign each item its background image.

      Another way you could do this is to make sure your images are named with the various document’s ID, or alias would also work. Then make up a rowTpl chunk:
      <li><a href="[+wf.link+]" style="background:url(assets/images/[+wf.alias+].jpg) left center no-repeat;">[+wf.menutitle+]</a></li>
      

      Or put the background to the <li> element, whatever you like. There’s probably at least four or five other ways you could work it out between the chunk templates and the CSS.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 36805
        • 354 Posts
        Quote from: sottwell at Jan 13, 2007, 02:40 PM

        [...]
        (I forget exactly if it’s the document ID or what, but it will be unique)
        [...]
        Allow me to quote the wiki on this:
        " &rowIdPrefix - (FALSE)
        if set, creates a unique id for each item (id is value of rowIdPrefix + docId)"

        http://wiki.modxcms.com/index.php/Wayfinder
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Thanks. I frequently forget my own phone number rolleyes That’s what computers are good for, they never forget anything.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 36582
            • 463 Posts
            Thank you Susan - worked a treat - too easy! (when you know how)
              Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk