We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8192
    • 4 Posts
    Hello dear community,

    I’m encountering a problem trying to set up WayFinder. Assuming that you, readers, will already know about it, I’ll go straightforward :

    I want to build a menu bar that can be compatible with another jquery menu that makes it way nicer. Therefor, I need to add classes to the <a> object, wich is obviously not loved by wayfinder.

    After reading the official docs downwards, upwards, and between the lines, here’s what I tried :

    -Simply adding the class a html text in the RowClass :
    <li[[+wf.id]]>
    <a href="[[+wf.link]]" class="wantedclass" title="[[+wf.title]]">[[+wf.linktext]]</a>
    </li>

    An then specifying that rowclass in the document as parameter in the wayfinder call to make sur it deosnt read the default settings. The output is working, without the class attribute :

    <li><a href="index.php?id=8" title="Contact" >Contact</a></li>

    So here stop me if I’m wrong, but assuming that this RowTpl is called a "template chunk" shouldn’t it be copied blindly to the output ? I don’t get it.

    -Including in the wayfinder call :
    When calling wayfinder, I tried adding &rowclass=`wantedclass`, and so whanged my RowTpl to :

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

    Neither worked.

    As i’m not a big Jquery professionel and can’t change the code to target a li.class instead of a a.class, I’m paused right now.
    And really courious to understand the logical solution, if there is one

    Any advice and comment would be welcome.

    Thanks
      • 33968
      • 863 Posts
      Hey, you’re almost there but you’ve confused &rowClass with &rowTpl.
      &rowClass (note capital letter) is the class you want inserted into [+wf.classes+].
      &rowTpl is expecting custom markup and Wayfinder placeholders in a chunk you created.

      I think this will work for you.

      Create a chunk called rowTpl:
      <li[[+wf.id]]>
      <a href="[[+wf.link]]" [+wf.classes+] title="[[+wf.title]]">[[+wf.linktext]]</a>
      </li>
      


      And your Wayfinder call:
      [!Wayfinder? &startId=`0` &rowTpl=`rowTpl` &rowClass=`wantedclass` !]
      
        • 8192
        • 4 Posts
        Thanks a lot Lucas, is was all because of the uppercase letter ...

        I’m now having another problem.

        I want to add subcfolders, that doesnt appear in the output.

        My call is now the following :
        [[Wayfinder? &startId=`0` &depth=`0` &limit=`20` &rowTpl=`RowTplCustom` &outerTpl=`OuterTplCustom` &innerTpl=`InnerTplCustom` &outerClass=`topnav` &innerClass=`subnav` &includeTVs=`1`]]

        &depth=`0` allows avery children item to be getted and showed, right ?

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

        RomTplCustom:
        <li[[+wf.id]][[+wf.classes]]>
        <a href="[[+wf.link]]" class="wantedclass" title="[[+wf.title]]">[[+wf.linktext]]</a>
        </li>

        The document which is a folder is displayed as a normal single document, and the child documents are not displayed at all.

        Hoping this will again look obvious to you, I think it doesnt needs more explainations.

        Thanks for you help
          • 33968
          • 863 Posts
          You’ve just missed the [[+wf.wrapper]] placeholder which tacks innerTpl onto your rowTpl:
          <li[[+wf.id]][[+wf.classes]]>
          <a href="[[+wf.link]]" class="wantedclass" title="[[+wf.title]]">[[+wf.linktext]]</a>
              [[+wf.wrapper]]
          </li>
          


          Add that in and your subfolders should show up.
            • 8192
            • 4 Posts
            Works perfectly thanks a lot !