We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29288
    • 13 Posts
    Hi all,

    I’ve taking a good look through the forums and MuddyDogPaws.com and i can’t really find a good tutorial on just what exactly needs to happen to get my dropline navigation up and running. I can get the first row in by using the snippet code provided at:

    http://www.muddydogpaws.com/development/wayfinder/examples/example-3.html

    but after that I’m lost as to what i need to do with the remaining code? does that go just below where i put the snippet code? or somewhere else? Can someone provide a link to, or a detailed walk-through. I’ve been banging my head against this one for a day now and, while I’m sure it’s not so overly complicated, i just don’t know where to start.

    Thanks so Much,

    -T huh
      • 16183
      • 1,390 Posts
      By the rest of the code I presume you mean the chunks? In the muddydogpaws page, all the stuff that comes below "Chunks Used" has to go into chunks for wayfinder to use as templates to construct the menu. So, for each "code", e.g. cssplay_parentRow, you need to create a chunk with that name. Do you know how to create chunks in modx? If not you will need to read modx’s beginner’s tutorials. (see  http://wiki.modxcms.com/index.php/Beginner%27s_Guide_to_MODx and http://modxcms.com/designer-guide.html , etc)

      So in the example menu you want (if you want it exactly as shown in muddydogpaws), you will need to create chunks with the following names (case sensitive) and paste the code for each chunk as shown in the example on muddydogpaws. For instance, the code for the chunk cssplay_inner as shown in the example is:

      <ul>
          [+wf.wrapper+]
      </ul>
      


      Chunks to create:

      1. cssplay_parentRow
      2. cssplay_outer
      3. cssplay_inner
      4. cssplay_row
      5. cssplay_dropline


      Once you get to know more about modx/WF you will realise you actually don’t need the 5th chunk above since WF can use the css used by the template you are using.

      In your CSS file, you will also need to have the following classes if you want styling to be applied to your menu (in this case for the "outerClass" and the "parentClass"):

      1. hide
      2. menu


      You will notice that the above chunks/templates and css classes are referenced (are being called) by the wayfinder snippet

      [[Wayfinder? &startId=`0` &level=`3` &parentClass=`hide` &parentRowTpl=`cssplay_parentRow` &outerTpl=`cssplay_outer` &innerTpl=`cssplay_inner` &rowTpl=`cssplay_row` &outerClass=`menu` &cssTpl=`cssplay_dropline`]]


      You will need to put this snippet call either in your template or in a document. Most likely you will have it in your template if you want all documents that use that template to have this menu

      Have you read this http://wiki.modxcms.com/index.php/Wayfinder to know what those chunks/templates and classes are actually doing? If not, please do. It will help you...

      Sorry, I notice am not very clear in my instructions (kinda in a hurry) but will check back to see how u r doing...and there’s the rest of the community too wink
        • 29288
        • 13 Posts
        Thanks so much for the response - I’m going to see what i can do with the info you’ve provided, just reading it in brief has cleared up a few things for me - i’ll keep you informed on how it goes.

        -T
          • 29288
          • 13 Posts
          Ok, so i created those chunks like you advised. and inserted the following code into the navigation div of template

          [[Wayfinder? &startId=`0` &level=`3` &debug=`true` &parentClass=`mainMenu` &parentRowTpl=`cssplay_parentRow` &outerTpl=`cssplay_outer` &innerTpl=`cssplay_inner` &rowTpl=`cssplay_row` &outerClass=`subNav` &cssTpl=`cssplay_dropline` &hideSubMenus=`true`]]


          I added the debug and the hidesubmenus.

          I aslo changed the outerclass to subNav (as that is the second row of navigation in my templates stylesheet) and parentClass to mainMenu; the Main menu UL class. (i tried it beforehand without changing any classes and neither had any effect on the navigation.)

          here is how the it sits inside of my template:

          
          <div id="navigation">
          <ul class="mainMenu">
          [[Wayfinder? &startId=`0` &level=`3` &parentClass=`mainMenu` &parentRowTpl=`cssplay_parentRow` &outerTpl=`cssplay_outer` &innerTpl=`cssplay_inner` &rowTpl=`cssplay_row` &outerClass=`subNav` &cssTpl=`cssplay_dropline` &hideSubMenus=`true`]]
          </ul>	
          <br class="spacer" />
          </div>
          
          


          the original template called for two nav styles, .mainMenu and .subNav (as the top and bottom tier were styled differently.) seen here:

          <div id="navigation">
          		<ul class="mainMenu">
          			<li><a href="#" class="selectMenu">Home</a></li>
          			<li><a href="#">About</a></li>
          			<li><a href="#">Services</a></li>
          			<li><a href="#">Support</a></li>
          			<li><a href="#">Chat</a></li>
          			<li><a href="#">History</a></li>
          			<li class="noBg"><a href="#">Contact</a></li>
          		</ul>
          		<a href="#" class="signup"></a>
          		<br class="spacer" />
          		<ul class="subNav">
          			<li class="noBg"><a href="#">Our Benefits</a></li>
          			<li><a href="#">What Our Future Plans</a></li>
          			<li><a href="#">Our Success</a></li>
          			<li><a href="#">Ratings</a></li>
          			<li><a href="#">Latest Blogs</a></li>
          			<li><a href="#">News</a></li>
          			<li><a href="#">Testimonials</a></li>
          			<li><a href="#">Comments</a></li>
          		</ul>
          		<br class="spacer" />
          	</div>



          So at the moment what is happening is this:

          The main nav displays fine, as it’s using the style from the <ul class="mainMenu"> that’s surrounding the snippet. But the subnav menus are displaying stacked-up below and with the same stylings as the main nav.

          For your reference, the CSS is styled as so:

          /*-------------------------- NAVIGATION PART --------------------------*/
          div#navigation-bg{
          	height:66px; background:url(images/navigation-bg.gif) 0 0 repeat-x;
          	}
          div#navigation-bg div#navigation{
          	width:922px; margin:0 auto;
          	}
          div#navigation-bg div#navigation ul.mainMenu{
          	padding:0; float:left; width:567px;
          	}
          div#navigation-bg div#navigation ul.mainMenu li{
          	width:81px; float:left;
          	background:url(images/navigation-divider.gif) 100% 0 no-repeat;
          	}
          div#navigation-bg div#navigation ul.mainMenu li a{
          	width:80px; height:33px; display:block;
          	line-height:33px; text-align:center;
          	font-weight:bold; color:#FAF0C2; font-size:11px;
          	}
          div#navigation-bg div#navigation ul.mainMenu li a:hover{
          	background:url(images/navigation-bg-selected.gif) 0 0 no-repeat;
          	}
          div#navigation-bg div#navigation ul.mainMenu li a.selectMenu{
          	width:80px; height:33px; display:block;
          	line-height:33px; text-align:center;
          	font-weight:bold; color:#FAF0C2; font-size:11px;
          	background:url(images/navigation-bg-selected.gif) 0 0 no-repeat;
          	}
          
          /*-------------------------- DROP DOWN MENU STARTS --------------------------*/
          ul.subNav{
          	font:normal 11px/12px Arial, Helvetica, sans-serif;
          	padding:4px 0 0 0;
          	}
          ul.subNav li{
          	background:url(images/navigation-dropdown-divider.gif) 0 0 no-repeat;
          	height:17px; float:left; padding:6px 0 0 0;
          	}
          ul.subNav li a{
          	display:block; margin:0 22px 0 20px;
          	color:#84915D;
          	}
          ul.subNav li a:hover{
          	color:#fff;
          	}
          /*-------------------------- DROP DOWN MENU ENDS --------------------------*/


          For a better idea, feel free to visit http://www.tannermooredesign.com/whiteribbon

          Again, thanks for the help. MODx is a killer CMS and once i figure out how to get these dynamic navigations up and running smoothly i’ll be using it on all my future projects.

          -T
            • 16183
            • 1,390 Posts
            T,

            Glad you got it up and running though it needs some modifications.

            Btw, let me say this first, in case you are wondering: You can name your chunks anything you want (with a few exceptions with regards to characters used,  I think). You don’t have to use the same chunk names as used in muddydogpaws. Remember, I am referring to the names of your chunks, AND NOT the way WF references those chunks, e.g. &outerTpl. So, what am saying is the value you give, for example &outerTpl=`THE NAME OF YOUR CHUNK CAN BE WHAT YOU WANT`

            OK, now first thing I notice with your menu is that you have an extra ul tag that you don’t need. Since WF generates an unordered list (ul) you didn’t have to place the snippet call inside <ul> tags like you did in your template. I would change that. If you created the chunks as shown exactly in muddydogpaws (which are just an example - yours can be different) then you notice the &outerTpl chunk (WHOSE VALUE = cssplay_outer) was already nested in a div. It looks like this

            <div[+wf.classes+]>
                <ul>
                    [+wf.wrapper+]
                </ul>
            </div>
            


            If you created your chunk like this then place the snippet call in your template right after where you have the comment <!--Navigation Part Starts -->. In your template (I mean the template for your website, not the template chunk) there’s no need for the extra ul tag with the class "mainMenu" nor is there need for the div with id "navigation" since WF can output this div for you as shown in the chunk above.. See below for my explanation on how to have an id for this div in the chunk.

            As for the classes, outerClass should have worked. It is the class for the outer template, i.e. the outerTpl. If you use parentClass you need to note that it will only work if that menu item is a folder (otherwise called a container), i.e. it has children. In your site, the documents that are parents are "Home", "Pledge" and "Press". So, the parentClass value, i.e. the class mainMenu is only being applied to these 3 documents.

            Anyway, in the output, if you use outerClass, the value of your outerClass (i.e. "mainMenu") will be added to the div in your outerTpl. WF will substitute the placeholder [+wf.classes+] that comes after the opening div in your outerTpl chunk with this class "mainMenu".

            WF has parameters that you can use to add classes to your submenu.  In your case, you have told WF that the value for the parameter outerClass is the class to be applied to the submenu. This is incorrect since WF applies outerClass to the outerTpl, i.e. the topmost/highest level of the menu structure. The topmost level of your menu structure according to the code in the chunk cssplay_outer is the div. So, your outerClass value, i.e. subNav is being applied to this div. That is why it is not working with your subnav. Since no class is specifically being applied to the subnav, I suppose it is inheriting its styling from the mainNav class

            You need to tell WF the correct class to apply to your subnav. You can use the WF class parameter innerClass.

            innerClass: The CSS class name specified in this parameter will appear in the [+wf.classes+] and [+wf.classnames+] placeholders of the &innerTpl template.

            In your case, the innerTpl chunk will now look like so:

            <ul[+wf.classes+]>[+wf.wrapper+]</ul>  


            In your snippet call, you can then have  innerClass=`subNav`

            Again, in the output, WF will put the class "subNav" right after the opening ul in your submenu

            If you want the div that is in the &outerTpl chunk (WHOSE VALUE = cssplay_outer) to have the id "navigation", then add this to the outerTpl chunk like so:

            <div id="navigation" [+wf.classes+]>
                <ul>
                    [+wf.wrapper+]
                </ul>
            </div>
            


            With the above changes, here’s your modified snippet call to add to your template like so:

            <!--Navigation Part Starts -->
            [[Wayfinder? &startId=`0` &level=`3` &outerClass=`mainMenu` &parentRowTpl=`cssplay_parentRow` &outerTpl=`cssplay_outer` &innerTpl=`cssplay_inner` &rowTpl=`cssplay_row` &innerClass=`subNav` &cssTpl=`cssplay_dropline` &hideSubMenus=`true`]]
            <!--Navigation Part Ends -->
            


            Note that the above has outerClass=`mainMenu` and innerClass=`subNav`

            Then style to your heart’s content. I hope this is clear....

            cheers  smiley


              • 29288
              • 13 Posts
              woah k.

              This is alot to digest, and thank you so much for taking the time to walk me through this, i’m going to take a crack at it and i’ll report back on my findings. In your opinion though, based on the provided CSS, will i need change my styling as well?

              --------------------

              Ok, so... Thanks again for all the help; i think i’m getting closer to having it working right, using the info you gave me and altering it a little i’ve got an outputted List structure that looks pretty good:
              <div id="navigation">
                <ul class="mainMenu">
                  <li><a  class="active" href="http://www.tannermooredesign.com/whiteribbon/" title="Welcome to The White Ribbon Campaign of Vermont">Home</a>
                    <!--[if lte IE 6]>
                  <a class="sub" href="http://www.tannermooredesign.com/whiteribbon/" title="Welcome to The White Ribbon Campaign of Vermont">Home
                  <table><tr><td>
                  <![endif]-->
                    <ul class="subNav">
                      <li><a href="/whiteribbon/index.php?id=2" title="About">About</a></li>
                      <li><a href="/whiteribbon/index.php?id=4" title="Resources">Resources</a></li>
                      <li><a href="/whiteribbon/index.php?id=5" title="Latest News">Latest News</a></li>
                      <li class="last"><a href="/whiteribbon/index.php?id=6" title="Events">Events</a></li>
                    </ul>
                    <!--[if lte IE 6]>
              	</td></tr></table>
                  </a>
                  <![endif]-->
                  </li>
                  <li><a href="/whiteribbon/index.php?id=3" title="FAQ">FAQ</a></li>
                  <li><a  href="/whiteribbon/index.php?id=9" title="Press">Press</a>
                    <!--[if lte IE 6]>
                  <a class="sub" href="/whiteribbon/index.php?id=9" title="Press">Press
                  <table><tr><td>
                  <![endif]-->
                    <!--[if lte IE 6]>
              	</td></tr></table>
                  </a>
                  <![endif]-->
                  </li>
                  <li><a  href="/whiteribbon/index.php?id=15" title="The Pledge">The Pledge</a>
                    <!--[if lte IE 6]>
                  <a class="sub" href="/whiteribbon/index.php?id=15" title="The Pledge">The Pledge
                  <table><tr><td>
                  <![endif]-->
                    <!--[if lte IE 6]>
              	</td></tr></table>
                  </a>
                  <![endif]-->
                  </li>
                  <li class="last"><a href="/whiteribbon/index.php?id=14" title="Contact">Contact</a></li>
                </ul>
              </div>
              <!--Navigation Part Ends -->


              The Problem as i see it now; is that while the new code nests the .subNav in the mainMenu, the original navigation structure (and CSS) worked on a non-nested setup. as seen in the example here:
              <div id="navigation">
              		<ul class="mainMenu">
              			<li><a href="#" class="selectMenu">Home</a></li>
              			<li><a href="#">About</a></li>
              			<li><a href="#">Services</a></li>
              			<li><a href="#">Support</a></li>
              			<li><a href="#">Chat</a></li>
              			<li><a href="#">History</a></li>
              			<li class="noBg"><a href="#">Contact</a></li>
              		</ul>
                <a href="#" class="signup"></a>
              		<br class="spacer" />
              		<ul class="subNav">
              			<li class="noBg"><a href="#">Our Benefits</a></li>
              			<li><a href="#">What Our Future Plans</a></li>
              			<li><a href="#">Our Success</a></li>
              			<li><a href="#">Ratings</a></li>
              			<li><a href="#">Latest Blogs</a></li>
              			<li><a href="#">News</a></li>
              			<li><a href="#">Testimonials</a></li>
              			<li><a href="#">Comments</a></li>
              		</ul>
              		<br class="spacer" />
              	</div>


              with the CSS as follows:

              /*-------------------------- NAVIGATION PART --------------------------*/
              div#navigation-bg{
              	height:66px; background:url(images/navigation-bg.gif) 0 0 repeat-x;
              	}
              div#navigation-bg div#navigation{
              	width:922px; margin:0 auto;
              	}
              div#navigation-bg div#navigation ul.mainMenu{
              	padding:0; float:left; width:567px;
              	}
              div#navigation-bg div#navigation ul.mainMenu li{
              	width:81px; float:left;
              	background:url(images/navigation-divider.gif) 100% 0 no-repeat;
              	}
              div#navigation-bg div#navigation ul.mainMenu li a{
              	width:80px; height:33px; display:block;
              	line-height:33px; text-align:center;
              	font-weight:bold; color:#FAF0C2; font-size:11px;
              	}
              div#navigation-bg div#navigation ul.mainMenu li a:hover{
              	background:url(images/navigation-bg-selected.gif) 0 0 no-repeat;
              	}
              div#navigation-bg div#navigation ul.mainMenu li a.active{
              	width:80px; height:33px; display:block;
              	line-height:33px; text-align:center;
              	font-weight:bold; color:#FAF0C2; font-size:11px;
              	background:url(images/navigation-bg-selected.gif) 0 0 no-repeat;
              	}
              
              /*-------------------------- DROP DOWN MENU STARTS --------------------------*/
              ul.subNav{
              	font:normal 11px/12px Arial, Helvetica, sans-serif;
              	padding:4px 0 0 0;
              	}
              ul.subNav li{
              	background:url(images/navigation-dropdown-divider.gif) 0 0 no-repeat;
              	height:17px; float:left; padding:6px 0 0 0;
              	}
              ul.subNav li a{
              	display:block; margin:0 22px 0 20px;
              	color:#84915D;
              	}
              ul.subNav li a:hover{
              	color:#fff;
              	}
              /*-------------------------- DROP DOWN MENU ENDS --------------------------*/


              I’m pretty solid with my HTML/CSS, and it would seem to me that the subnav, as it’s nested, is inheriting elements of mainMenu. But i seem to be at a loss on how to stop that from happening, asside from giving the .subNav list-items their own class, but then i’m not sure on how to add that to the _inner chunk... I have two thoughts, one rewritting the CSS or two, restructuring the generated wayfinder UL/LI structure to recreate the original Nav structure. I guess my question for you is, which is easier / better and if so, can you please advise?

              Again, thanks so much. you kick ass.

              -T
                • 16183
                • 1,390 Posts
                T,

                Glad you are making progress...

                OK, the menu is being output correctly by WF but I have looked at your CSS and that’s where the problem is. I don’t know whether you have updated it yet or not but I have just visited the test site and looked at the CSS.

                1. You have have grouped CSS selectors in several places in your CSS but you haven’t correctly separated them. You need to separate them with a comma. e.g. in your CSS, you have....

                div#navigation-bg div#navigation


                This should be
                div#navigation-bg, div#navigation


                2. Giving the .subNav list-items their own class is an overkill, IMHO

                3. The CSS in the original menu doesn’t seem to be too complicated so whether to to edit or write your own is almost a 50/50 decision. I would lean toward writing my own CSS though

                4. If writing your own, choose your selectors carefully while taking into consideration specificity and descendant selectors as necessary.

                A few examples

                You could have the following CSS selectors for your navigation

                For the main menu container

                div#navigation {your css rules}
                ul.mainMenu {your css rules}


                The menu links

                ul.mainMenu li a{your css rules}
                ul.mainMenu li a:hover{your css rules}
                li.active{your css rules}


                for the sub-menu links

                ul.subNav li a {your css rules}
                ul.subNav li a:hover {your css rules}


                That should get you going.  grin

                /k
                  • 29288
                  • 13 Posts
                  YEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSSSSSS!!!!! laugh

                  Awesome. Working. Finally, my client is going to be very happy.


                  Thanks so much for all your help; you’ve been very patient - now that i got this working i think i have a pretty good idea go on from here. Thanks again, I’ll be sure to stick around in the MODx forums and help out anyone i can to pay it forward.

                  -Tanner grin
                    • 16183
                    • 1,390 Posts
                    Quote from: tanmccuin at Dec 11, 2008, 04:04 PM

                    YEEEEEEEEEEEEEESSSSSSSSSSSSSSSSSSSSSSSS!!!!!  laugh


                    Brilliant! There’s a happy customer  laugh

                    I would remove any unnecessary code in the final site = e.g. the debug parameter in the WF call. Nice site you have there...and even better it’s for a worthy cause...

                    Welcome to modx, btw..should have said that at the beginning... rolleyes

                    cheers/k