We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22427
    • 793 Posts
    In Revo 2.1.2, trying to call Wayfinder (2.3.1) with the parameter [tt]&categoryFoldersTpl[/tt] I run into an issue I don’t understand.

    I use the link attribute [tt]rel="category"[/tt] for the page I don’t want to become a link in the WF output - of course, it has children with the checkbox [tt]Hide From Menus[/tt] unchecked.

    My call is
    [[!Wayfinder? 
        &startId=`0` 
        &level=`0`	
        &hideSubMenus=`0`
        &categoryFoldersTpl=`catrow`
    ]]
    and of course I thought my chunk [tt]catrow[/tt] was the culprit.
    To test this, I replaced its code by the code of the default rowTpl:
    <li [[+wf.id]] [[+wf.classes]] >
    <a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>
    [[+wf.wrapper]]
    </li>
    
    So the menu item of that special page should be output like all the other rows.

    Instead I become the strange result that the created code for that special row containes a totally empty link:
    <li>
    <a href="" title="" ></a>
    </li> 
    
    Now I’m clueless what is happening here.

    Edit:

    Looking around in the file [tt]wayfinder.class.php[/tt] , in the function which has to "determine which template to use", I found the following piece of code (line 295-296):
            } elseif ($resource['isfolder'] && ($resource['template']=="0" || is_numeric(strpos($resource['link_attributes'],'rel="category"'))) && $this->_templates['categoryFoldersTpl'] && ($resource['level'] < $this->_config['level'] || $this->_config['level'] == 0)) {
                $usedTemplate = 'categoryFoldersTpl';	
    
    Here I don’t understand the condition
    [tt]($resource[’level’] < $this->_config[’level’] || $this->_config[’level’] == 0)[/tt].

    Ok, I do understand this. grin

    Any hint is much appreciated!

    Thank you
    ottogal
      • 22427
      • 793 Posts
      My problem is solved.

      Playing around with various Wayfinder calls I got the insight that it was due to the fact that my chunk [tt]catrow[/tt] is located in my filesystem (as [tt]/assets/chunks/catrow.html[/tt] ) and is fetching its code through this snippet named [tt]chk[/tt]:
      <?php
      //                        [[chk? &file=`foo.html`]]
      $path="assets/chunks/";
      return file_get_contents($path.$file);
      ?> 
      The Chunk code of [tt]catrow[/tt] was
      [[!chk? &file=`catrow.html`]]

      This did not work.

      When I replaced the call of [tt]chk[/tt] by the code itself,
      <li [[+wf.id]] [[+wf.classes]] >
      [[+wf.linktext]]
      [[+wf.wrapper]]
      </li>

      the Wayfinder call
      [[!Wayfinder? 
          &startId=`0` 
          &level=`0`	
          &hideSubMenus=`0`
          &categoryFoldersTpl=`catrow`
      ]]
      worked well, and the same was the case if I used
      &categoryFoldersTpl=`@CODE:<li [[+wf.id]] [[+wf.classes]] >[[+wf.linktext]][[+wf.wrapper]]</li>`


      Then I changed the call of [tt]chk[/tt] to cached:
      [[chk? &file=`catrow.html`]]
      Surprisingly, now also the version [tt]&categoryFoldersTpl=`catrow`[/tt] worked.

      I was astonished because I thought that with Revo the question of calling nested snippets alternating in uncached and cached mode had become obsolete. Do I misunderstand something here?

      And, with my chunk in the file system, I would expect that the following should work too:
      &categoryFoldersTpl=`@FILE:/assets/chunks/catrow.html`
      But it does not.

      Anyway, I set this thread to SOLVED. smiley