On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I'm quite stuck on an unexpected problem. I'm trying to use Wayfinder to generate a sitemap for a project. The output of the navigation items is as expected, but I need to include a number of documents in addition to the primary navigation elements.

    To do this, I have used the includeDocs parameter.

    [[Wayfinder? &startId=`0` &includeDocs=`17,18,19,20`]]

    When I do this, I get no output at all. Remove includeDocs and I get the standard nav (expected). Use the param and the output is completely empty.

    No idea what I'm doing wrong or what (if any) other setting must be defined in order to make this work.
    • Looking at the code in Wayfinder, I'm not sure this property is used to include additional elements? It appears to me that this will limit the results to 17,18,19,20, if 17,18,19,20 appear in the original dataset.

      /* if set, limit results to specific resources */
      if (!empty($this->_config['includeDocs'])) {
        $c->where(array('modResource.id:IN' => explode(',',$this->_config['includeDocs'])));
      }


      Only those resources which are in both are returned. I might be wrong, as this was just a quick glance, but this would explain it.
      • Almost the same code in Evo.

        if ($this->_config['includeDocs']) {
        	$menuWhere .= " AND sc.id IN ({$this->_config['includeDocs']})";
        }
        


        Additional resources could not be added this way.

        Anyway, since you are using &startId=`0`, the resorces 17, 18, 19, 20 should be shown, but only if they are not hidden from the menu.
        • Sorry, we're talking Evo. I wasn't paying attention to the thread group!
          • Thanks for the input. IncludeDocs is a terrible name for this parameter.

            I ended up having to create a series of Wayfinder calls in order to display the elements desired.
            • Yes, the parameter name could be called better. To include additional resources (without checking if they are visible, published, deleted, allowed for the current user etc.) you could try to add
              &where=`1=1 OR sc.id IN (17,18,19,20)`

              to the snippet call. Untested.
              • That's a good idea, Jako. Thanks! I'm already working from a modified version of Wayfinder. I made it capable of using resource children under different parents, so a section could appear under more than one parent category. Adding another parameter shouldn't be too big of a deal.
                • Simple solution is used
                  &excludeDocs=``
                  if nearby resources is not so much.
                  And maybe useful
                  &ignoreHidden=`1`
                  to mark them in "Hide From Menus" [ed. note: alex_dutch last edited this post 6 years, 9 months ago.]