We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10190
    • 187 Posts
    Quote from: ottogal at Mar 26, 2009, 04:35 PM

    Hi Frisco,
    I’m glad you made it and that my idea wasn’t too far from it. There was just a typo in my proposal - instead of &outerTpl it should read &outerClass. grin
    But of course handling the template is a good way too.

    Hi ottogal,

    I’ll try this too, ’cause I’d like it more to have things in one place - everything in the snippet call is more easy than to scatter it amongst templates and chunks.

    Cheers, Frisco
      • 16183
      • 1,390 Posts
      Am late to this party but am wondering why Wayfinder’s &rowIdPrefix parameter shouldn’t work in this case? Am I missing something?  I tried the following and it worked fine (see screenshot)

      I want the &rowIdPrefix to be applied to the top level items only so I created both a &rowTpl and an &innerRowTpl

      Here are the chunks:

      The &rowTpl - notice the [+wf.id+] placeholder. This will ensure the &rowIdPrefix will be output to row items, in my case, only first level row items since I also have a row template for my submenus (the &innerRowTpl)

      <li [+wf.id+] [+wf.classes+] >
      <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
      [+wf.wrapper+]
      </li>
      


      The &innerRowTpl - notice that I didn’t include the [+wf.id+] so that no id="" will be output. I don’t need ids for these items.
      <li[+wf.classes+]>
      <a href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>
      [+wf.wrapper+]
      </li>
      


      My Wayfinder call: Of course yours might be different. For instance, I am using &cssTpl just for this particular example, etc.

      [[Wayfinder? &startId=`0` &outerTpl=`testMenuContainer` &rowTpl=`testMenuRows` &innerRowTpl=`testSubmenuRows` &level=`2` &cssTpl=`testcsstpl` &excludeDocs=`3,7,16` &rowIdPrefix=`test`]]
      


      Now Wayfinder will give my top row menu items nice ids prefixed with "test" just before the relevant doc id.

      Here’s the CSS

      ul#test li {list-style-type:none; margin: 0; padding: 0; width: 12em; float: left; }
      ul#test li ul {list-style-type:none; margin: 0; padding: 0;}
      ul#test li a {text-decoration: none; font-size: 1.5em;}
      ul#test li ul a{ text-decoration: none; font-size: 1.2em;}
      li#test1 a {color: green;}
      li#test2 a {color: blue;}
      li#test3 a {color: red;}
      li#test4 a {color: white;}
      li#test5 a {color: yellow;}
      li#test6 a {color: orange;}
      


      It worked fine for me. So, no need for TVs, etc. But then again, this is MODx....there’s always another way.... wink

      And below’s a screenshot.

      cheers/k

        • 22427
        • 793 Posts
        You’re totally right, kongondo! So anew we have evidence that you are a real connoisseur of Wayfinder!
          • 7231
          • 4,205 Posts
          I had misunderstood the question, which is silly since there is even an example of what was the objective. I thought it was a different color for each level not each each section.

          Top level (green)
          -- second level (orange)
          -- third level (yellow)

          And the solution I had considered was to use phx with the level placeholder to identify each level and assign a color class.

          You’re totally right, kongondo! So anew we have evidence that you are a real connoisseur of Wayfinder!
          You could say that kongondo wrote the book on the subject grin grin
            [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&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 10190
            • 187 Posts
            @kongondo:

            Thanks for your thorough explanation, I think I definitly have to learn more about CSS. I already downloades your e-book on WF, can’t wait to reading it, great that you made it!

            But I have to say that I think I like the solution with TVs more, as it gives me the possibility to put the color of menu item to the editing of the items themselves - I think that’s better than to hardcode it in the CSS connected to document IDs - ’cause they might change.

            Or to put it the other way round, it’s more transparent if I wan’t to make changes in the future - I simply like having options in a GUI instead of hidden in a conf file (like the CSS declaration).

            But that’s just a question of what I like more - your solution works perfekt!

            Cheers, Frisco

              • 16183
              • 1,390 Posts
              @Frisco

              I’m glad it’s working fine for you and I like your GUI explanation. I would only suggest one thing. You said in an earlier post that

              I now have id="menuorange" for all ORANGE menu items (including subs)...

              Having one ID applied to multiple items is considered incorrect and in some cases can result in unexpected behaviour (java and css-wise). You probably want to change that to class since that is what classes are for...to be applied to multiple items. So...something like class="menuorange".

              All the best with you project!

              cheers/k