We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    Quote from: sottwell at Apr 02, 2006, 11:48 AM

    I’ve done that when I wanted to have a different background for each main menu item. I simply added an incrementing variable into the MakeMap loop and appended it to the LI class specified in the snippet options when the <li... tag is being generated.

    <ul class="topnav">
    <li class="category1">Item One
    ...submenu
    </li>
    <li class="category2">Item Two
    ...submenu
    </li>
    <li class="category3">Item Three
    ...submenu
    </li>
    <li class="last category4">Item Four
    ...submenu
    </li>
    </ul>



    could you post the change here and the sntippet call?
      follow me on twitter: @dimmy01
    • Depending on the version number your line numbers may vary.
      Line 217:
      $categoryNumber = 1; // initialize li class number - sottwell
      //loop through and process subchildren
      foreach ($children as $child) {
      // figure out if it's a containing category folder or not 
      

      Line 277:
      // it's an empty folder and using Category Folders
      if ($useCategoryFolders && $itsEmpty) {
      $class .= ($class ? ' ' : '').$categoryClass.$categoryNumber; // append li number - sottwell
      }
      

      and line 298:
          $class = '';
          $categoryNumber++; // increment li class number - sottwell
          }
        }
      $output .= "</ul>$ie";
      


      Snippet call:
      [[DropMenu?startDoc=`49`]]


      I only wanted this for empty top-level folders, so that’s where I added the number variable. You can see where I used this here. Each top-level li has a different background image. The "category" class is automatically added to empty folders; you can of course change the name in the snippet call with &categoryClass.
        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
        • 7455
        • 2,204 Posts
        Nice this is exacly what i need aswhell
          follow me on twitter: @dimmy01