We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25803 ☆ A M B ☆
    • 721 Posts
    I’ll need to sit down one day and sketch out how all this works so I can understand it structurally.
    I’ve had a template created with accompanying CSS - The demonstration (static) version is Here.

    I need to recreate the menus in the footer and use Wayfinder so they are dynamic.

    The results, thus far (after a considerable amount of time) are Here.

    It’s probably something obvious but I can’t figure it out.

    My Wayfnder call:

    [!Wayfinder?&startId=`6`&displayStart=`true`&startItemTpl=`footerheader`&rowTpl=`footerrow`!]


    I also tried:

    [!Wayfinder?&startId=`6`&displayStart=`true`&outerTpl=`footerouter`&startItemTpl=`footerheader`&innerRowTpl=`footerrow`!]


    But get the same results. I’m not sure how to get it all in one list rather than having the Wayfinder create to unordered lists.

    Chunk: footerouter
    <ul>
    [+wf.wrapper+]
    </ul>


    Chunk: footerheader
    <li class="head">[+wf.linktext+]</li>[+wf.wrapper+]


    Chunk: footerouter
    <li><a href="[+wf.link+]" title="[+wf.title+]">[+wf.description+]</a></li>[+wf.wrapper+]


    Any suggestions or experience with something like this?

    I need to replicate this type of structure:
    <ul>
    <li class="head">Enviroment</li>
    <li><a href="#">FSC</a></li>
    <li><a href="#">Green Initiative Program</a></li>
     <li><a href="#">Whitepapers</a></li>
    </ul>
    


    I’m using the Description placeholder to act as reduced versions for the footer menus.
      • 2148
      • 4 Posts
      rx2, how do you place main navigation and subnavigation into different places of html code? I can’t seems to separate wayfinder navigation’s main and submenus into different <ul> elements huh
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Go and get the document you can download from Wayfinder’s Wiki page. It has quite a bit of information on how to use templates for each part of the menu.

        http://wiki.modxcms.com/index.php/Wayfinder200
          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
          • 2148
          • 4 Posts
          sottwell, I’ve read your page. Actually I’m reading resources for a couple of days and undesrtanding is coming very slowly.
          Could you put some light into my problem stated here?

          http://modxcms.com/forums/index.php/topic,28416.0.html

          Thank you!


            • 25803 ☆ A M B ☆
            • 721 Posts
            Quote from: Arsenic at Aug 29, 2008, 10:41 AM

            rx2, how do you place main navigation and subnavigation into different places of html code? I can’t seems to separate wayfinder navigation’s main and submenus into different <ul> elements huh

            You can make multiple calls. For example, the main navigation call is this:

            [[Wayfinder?&level=`1`&config=`mainmenu`&startId=`0`]]
            


            With a config file that looks like this:

            <?php
            	$lastClass = 'last';
            	$hereClass = 'active';	
            	$outerTpl = '@CODE:<ul id="main-nav">[+wf.wrapper+]</ul>';	
            	$rowTpl = '@CODE:<li><a[+wf.classes+] href="[+wf.link+]" title="[+wf.title+]"><strong>[+wf.linktext+]</strong><br />[+wf.introtext+]</a></li>';
            
            ?>
            


            Which produces this:

            <ul id="main-nav"><li><a class="active" href="http://harmony.adrenalineonline.net/" title="Harmony Printing Limited"><strong>home</strong><br />the first page</a></li>
            <li><a href="/The-Harmony-Team" title="The Harmony Team"><strong>the team</strong><br />get to know us</a></li>
            <li><a href="/Environment" title="Environment"><strong>environment</strong><br />we help you go green</a></li>
            <li><a href="/Workflow" title="Workflow"><strong>workflow</strong><br />an organic model</a></li>
            
            <li><a href="/Print" title="Print"><strong>print</strong><br />we speak cmyk</a></li>
            <li><a href="/Mailing-Services" title="Mailing Services"><strong>Mailing Services</strong><br />optimized delivery</a></li>
            <li><a href="/New-Media" title="New Media"><strong>new media</strong><br />we speak html</a></li>
            <li><a href="/Harmony-Blog" title="The Harmony Blog"><strong>blog</strong><br />thought provoking</a></li>
            <li><a class="last" href="/Contact-Harmony" title="Contact Harmony"><strong>contact us</strong><br />let's connect</a></li>
            </ul>
            


            Which, except for the lack of a carriage return in code is exactly like the static XHTML/CSS page created as a template before moving into MODx (and the addition of a title attribute). I’m not sure why therefore, it isn’t displaying properly but that’s another matter.

            The key is in the config file which you place under the configs folder in the wayfinder folder under the snippets folder. You only have to refer to the name of the file and not the extensions. For example, in my case, it’s mainmenu.config.php. I’ve made sure that the active and last classes are in use (though I believe active is a default anyway.) Then I ensure the structure of the unordered list by defining both the outer template and the row template appropriately. You use placeholders to have MODx automatically place what needs to be placed where. In my case, I’m drawing the little descriptive text from the intro text field, hence the use of the wayfinder placeholder [+wf.introtext+].

            For the sub menu I have the following call:

            [!Wayfinder?&config=`submenu`&startId=`[[UltimateParent]]`!] 
            


            And the submenu.config.php has this:

            <?php	
            	$outerTpl = '@CODE:<ul id="sub-nav">[+wf.wrapper+]</ul>';	
            	$rowTpl = '@CODE:<li><a href="[+wf.link+]"[+wf.classes+] title="[+wf.title+]">[+wf.linktext+]</a>[+wf.wrapper+]</li>';
            ?>
            


            Note how I did not have to define the active class because it is a default. UltimateParent is a snippet that travels up the document tree automatically. In this case, it travels to the top which is any document at the top level of the tree, as far as I understand at least, thus avoiding the need to identify an explicit and specific start ID for the sub menus.

            I’ve read all the documentation over and over again, and I will, when I have time, sit down and sketch things out as I’m a very structural thinker and react to visual wireframes and how they relate to code, but I cannot for the life of me figure out how to create the menus in the footer. It’s evident that no one else has done anything like it as well so I’ll just do it manually for now.
              • 25803 ☆ A M B ☆
              • 721 Posts
              Quote from: sottwell at Aug 29, 2008, 10:59 AM

              Go and get the document you can download from Wayfinder’s Wiki page. It has quite a bit of information on how to use templates for each part of the menu.

              http://wiki.modxcms.com/index.php/Wayfinder200

              Thanks. The diagrammatic elements really helped and now I’ve got it working. For those that are interested.

              The WF call:

              [!Wayfinder?&startId=`5`&outerTpl=`footerouter`&displayStart=`true`&startItemTpl=`footerheader`&rowTpl=`footerrow`!]
              


              Where startId is the relevant ID of the document.

              The outer template is:

              [+wf.wrapper+]
              


              Because of this:

              Note that, if &displayStart parameter is set to TRUE, then Wayfinder will place the output of &outerTpl (which contains the entire menu structure!) into the [+wf.wrapper+] placeholder of the &startItemTpl, so be sure to include this placeholder in your custom template!

              I needed to place the displayStart template effectively inside the unordered list so I excluded the ul tags from the outer template and included them in the header template like so:

              <ul>
              <li class="head"><a href="[+wf.link+]">[+wf.linktext+]</a></li>[+wf.wrapper+]
              </ul>
              


              Finally, the row template:

              <li><a href="[+wf.link+]" title="[+wf.title+]">[+wf.description+]</a></li>
              


              This is added in [+wf.wrapper+] part after the defined list item in the header template which in turn surrounds the outer template because it is put in it’s entirety into the start row template. It was a little bit difficult logic for me, at this point, which tripped me up. This document is the best document I’ve come across and though I’ve been to that wiki page I missed the link and I assumed all of that would be in the wiki. My bad of course.