We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9763
    • 16 Posts
    I am only just getting started with MODx and really like what I see.
    The layout for the site I am working on has main navigation to each folder (section) on every page.
    Once within a section, a list of links to all it’s subfolders (subsections) is shown on each section page.

    I am just using one standard template for all pages at the moment (excluding the home page).
    I have a dropmenu snippet for the main nav and that is working fine.
    I set up a Template Variable for the sub nav and have set its default value to @INHERIT.
    Then I went into the parent page for each section and changed the TV value to:
    [[DropMenu? &menuName=`subNav` &startDoc=`n` &levelLimit=`1` &topnavClass=`subNav` &hereClass=`activeLink`]]
    


    I substituted the id of the folder page for n each time, to produce a list of the documents just within that folder.

    This is a fairly standard layout structure, so have I approached this in the right way? The only other way I can see is to have a different template for each section - would that be preferable? I am only learning how to use MODx at the moment so would like to know the easiest method of implementing this.

    The way things stand with the current implementation, it would be best if the values for the template variable were only editable by administrator level users. I know you can lock the template variable itself, but is it also possible to specify that only users with certain values can edit the values of certain template variables in the documents they are used in?

    Thanks,
    fizzy.
    • For each section, does the navigation stay the same (including for the subpages)?
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 9763
        • 16 Posts
        Yes, the secondary navigation is section wide and the main navigation is site wide.

        For example, if I had 3 sections:

        About Us, Services, Contact Us

        Each page on the site would show a menu with these 3 sections (primary nav).

        However the About Us pages would also show secondary navigation to the pages in that Section:

        Background, Our Team, Careers

        While the Contact Us pages would show links to subpages within Contact Us instead:

        Contact Details, Enquiry Form, Location Map

        I hope this clarifies things?! smiley
        • Hi Fizzy,

          I think you’re implementing your navigation similar to how I’ve done on my site.

          In which case you could use the ’List Child or Siblings’ snippet for your secondary navigation and keep DropMenu for the primary navigation.

          Hope that helps,

          Garry
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 9763
            • 16 Posts
            thanks garry,

            i’ll look into that....

            i should have added though that some of my secondary nav links will be going to folders rather than just documents.
            when this happens, i actually need the secondary nav to stay the same i.e. no matter how deep down a section goes, the secondary nav will only ever show links to the top level folders and docs.

            e.g. for *all* pages in About Us, the secondary nav should always show Background, Our Team, Careers even though Our Team has several child pages of its own (Bob, Mary, Susan).

            So, even on the About Us > Our Team > Mary page, the secondary nav should say Background, Our Team, Careers.

            I’m thinking that the list child snippet would switch to showing Bob, Mary, Susan in that case, which may be more intuitive but not what my spec wants smiley I’ll give it a go and find out!
              • 13736
              • 345 Posts
              I realize it has only been 5 days since the last post, but did you ever get this secondary menu working?

              I have also been working on a site that has tabs across the top which match up to the top most 3 site folders. And then the goal is to have a secondary menu on each tab which pulls from that tree. How do I vary the branch to each secondary menu. I figured out how to hard code it, but a variable method would be much cleaner. Rather than creating 3 separate templates.

              Was that clear?

              - Jeff
              • Is this the sort of thing you mean?

                http://www.alandaniel.co.uk/pearl-profile.html

                That’s done using TVs for the left column content, and using different startDoc arguments for the next level.

                You could also use the GetUltimateParent snippet if you need multilevel submenus based on the top-level parent folder.
                  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
                  • 9763
                  • 16 Posts
                  Quote from: jbjones at Mar 07, 2006, 11:41 AM

                  I realize it has only been 5 days since the last post, but did you ever get this secondary menu working?

                  hi jeff,

                  the way i have it working at the moment is by using one template site wide, but using a template variable for the seconday nav with default value @INHERIT. for each top-level nav item, i set the the template variable content to the drop menu i need for that section. this then sets the secondary nav for that section.

                  i have hard coded the value for each section e.g. on the folder with id 9 i have set it to [[DropMenu? &menuName=`subNav` &startDoc=`9` &levelLimit=`1` &topnavClass=`subNav` &hereClass=`activeLink`]]

                  it would be nice if i could do something more dynamic so that it automatically feeds off the right start doc without me specifying it, but i’m just finding my feet and it’s very little work to set it for each section anyway smiley

                  good luck!
                    • 13736
                    • 345 Posts
                    Thanks for the reply. I got it mine working finaly. I sort of gathered that you were doing that from your first post, however I couldn’t get the @INHERIT to work. I kept typing

                    @INHERIT [[DropMenu ....]]

                    into the template variable when I should have just been replacing the whole @INHERIT command with the wanted tag. Maybe someone should specify that in the manual.

                    I agree that an automated method would be nice. It would be nice to be able to tell the DropMenu snippet to pull from the second or third level of folders from the top within its branch instead of a specific folder. Maybe that would be a good feature suggestion.

                    A new switch or something like this maybe:

                    &startDocType= [ SPECIFIC or RELATIVE ]

                    or just build the intelegence into the switch and tack on LEVEL

                    &startDoc= [ LEVEL2 ]

                    Again, thanks for the help.