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

    There’s like a bug with Wayfinder 2.0 when the call is done from a template. (I use MODx 0.9.6.2)
    Wayfinder seems unable to set the startId dynamically from the current document id.

    [!Wayfinder? &config=`myConfig`  &startId=`[*id*]` !]
    does not work when called directly from a template.
    (Also not when the startId definition was stored in the config file.)

    I read that startId is the only parameter of Wayfinder which is always required.
    This seems both true and false for Wayfinder 2.0 :
    - this is true when Wayfinder is called from within a template
    - this is false when Wayfinder is called from within a document or a template variable inserted in a document, as we can simply omit to mention the startId and Wayfinder will take the id of the current document.

    As the [*id*] placeholder is unable to retrieve the document id when placed in a Wayfinder call located in a template, I tried this :
    [!Wayfinder? &startId=`[[GetField? &field=`id`]]`!]

    This also works fine when the call is done from a document, but not when done from a template.

    I wondered if these strange behaviours are due to some exectution order of the PHP scripts.
    Does someone have any explanation ?

    Thanks.
      • 4946
      • 1 Posts
      Just to report that I also have the same problem with same versions of modx & wayfinder. Does anybody have any idea of the solution to get current document ID in wayfinder when ’[*id*]’ is not working ?
      Thanks in advance for your precious help !
        • 19741
        • 90 Posts
        I hope, that i understand you:

        http://www.muddydogpaws.com/development/wayfinder/parameters.html says, that startId has current id as default value. So you don’t have to give the id like [*id*], just omit the parameter.
          Bye,
          Mithrandir
          • 15001
          • 697 Posts
          Thanks. I could solve the problem. I was doing errors by absent-mindedness.

          My menu was disapearing when accessing a child document and this was simply because this child itself had no childs.
          I could solve the problem by setting startId=`[*parent*]` for the template used by child documents, so that the brother documents are listed as I wanted.