We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23299
    • 1,161 Posts
    I have a sort of a procedural question...

    Say I have a page structure with two different menu systems: one on the top and one on the sidebar. The sidebar menu is where all the dynamically created pages will go. Wayfinder is the obvious choice to make that happen in MODx. My question is with the top menu. Say hypothetically this menu will be a short list of fixed links like Home, About, Contact etc. Say this menu list will never change and is displayed with a one graphic nav_sprite that is rendered with CSS and possibly jQuerry. The sprite displays direct links with no drop down sub links.

    Is Wayfinder really needed for this menu? The code for this menu could just be rendered within the template and/or chunk, no? Or is it better practice to code this kind of menu with Wayfinder?

    Just trying to get a handle on how folks address this kind of two menu structure...

    Thanks,

    Max
      • 22770
      • 285 Posts
      I wouldn’t use Wayfinder for the top menu unless you want some kind of ’active’ class on the current item, which is what I tend to have, for highlighting.
        • 18374
        • 69 Posts
        I use Wayfinder for the top/primary navigation as well, but will use the includeDocs parameter to only include the pages I need. Rarely changes, and since my primary nav is usually image based, adding new items would need some manual intervention anyway.

        The only thing I don’t like about this approach is that I have to modify my CSS file to use the Wayfinder-given IDs instead of my semantic ones. "primary-nav-1" just isn’t as clean as "primary-nav-products" IMHO.
          • 3749
          • 24,544 Posts
          I think I’d skip the overhead of a Wayfinder call. Wayfinder does a quite a lot of processing that you don’t need at all, and does it for every page (although the results could be cached in your scenario). I might put the top menu in a chunk.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 23299
            • 1,161 Posts
            Thanks guys...

            Some good viewpoints here...
              • 25663 MODX Staff
              • 12,272 Posts
              If you cache the Wayfinder call the heavy processing only happens once.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 7231
                • 4,205 Posts
                In some cases I will use a custom menu builder snippet for the main navigation. You can get the classes to work with a little simple logic to check the current page id and test against the id for the menu pages.

                I build a menu based on a comma delimited list of ids &docs=`2,4,15,1,33` then turn the string into an array and process each item with a foreach loop and use the API to get the document fields you want to output.
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don't know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 15987
                  • 786 Posts
                  Just make sure you use a cached call as stated by others above. That is what I typically do.

                  Quote from: markhurd at Mar 26, 2009, 01:55 PM

                  The only thing I don’t like about this approach is that I have to modify my CSS file to use the Wayfinder-given IDs instead of my semantic ones. "primary-nav-1" just isn’t as clean as "primary-nav-products" IMHO.

                  How are you generating these ids? Are you using the docid placeholder? If so, I have added the alias as a placeholder in the new beta version. This might give you better ids if you are generating them for every menu item.