We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18374
    • 69 Posts
    I’m creating a multilingual site and need to update the primary navigation based on the user’s location in the page tree (each language is set up in it’s own container).

    My current call is as follows (formatted here for readability):

    [+phx:if=`[!UltimateParent!]`:is=`122`:then=
    `[!Wayfinder? &startId=`122` 
    &hereClass=`active` 
    &rowIdPrefix=`primary-nav-` 
    &outerTpl=`primaryNav_outerTpl` 
    &rowTpl=`rowTpl` 
    &includeDocs=`2,3,4,5,65,6,7,8`!]`
    :else=
    `[!Wayfinder? &startId=`124` 
    &hereClass=`active` 
    &rowIdPrefix=`primary-nav-` 
    &outerTpl=`primaryNav_outerTpl` 
    &rowTpl=`rowTpl` 
    &includeDocs=`126,13,161,199,209,210,224`!]`+]
    


    The UltimateParent call returns ’122’ as anticipated - but the PHx logic is always executing the ’else’ conditional - whether it’s a Wayfinder call or just a string of ’foo’.

    Looking on the wiki didn’t lead to anything new. The Wayfinder call operates correctly when PHx is removed from the equation - am I leaving something out or writing my PHx incorrectly?
      • 33337
      • 3,975 Posts
      Zaigham (aka zi) Reply #2, 15 years ago
      Thats odd. Try reversing the logic, eg. ne=`122`
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 18374
        • 69 Posts
        Thanks for the suggestion, but it didn’t seem to work.

        Here are the results of a simplified test:

        [!UltimateParent!] // returns 122
        [+phx:if=`[!UltimateParent!]`:is=`122`:then=`1`:else=`2`+] // returns 2
        [+phx:if=`[!UltimateParent!]`:ne=`122`:then=`1`:else=`2`+] // returns 1
        


        huh
          • 33337
          • 3,975 Posts
          Zaigham (aka zi) Reply #4, 15 years ago
          Ok Try this:
          [+phx:if=`[!UltimateParent!]`:is=`122`:then=`[!UltimateParent!]`:else=`[!UltimateParent!]`+]
          


          And see what comes out tongue ...

          It will help to see whats the value inside the PHX
            Zaigham R - MODX Professional | Skype | Email | Twitter

            Digging the interwebs for #MODX gems and bringing it to you. modx.link
            • 18374
            • 69 Posts
            Here are the results. Now I’m just getting more and more confused, as it seems to be working as intended:

            [!UltimateParent!] // returns 122
            [+phx:if=`[!UltimateParent!]`:is=`122`:then=`[!UltimateParent!]`:else=`[!UltimateParent!]`+] // returns 122
            


            This is the case for every page in the tree (fortunately! at least that’s working! laugh)

            In the Spanish tree (UltimateParent of 124) it returns the correct value as well (124 again).
              • 33337
              • 3,975 Posts
              Zaigham (aka zi) Reply #6, 15 years ago
              Now thats something really confusing. Yeah! lol

              I cant think of anything which could be wrong atm.
                Zaigham R - MODX Professional | Skype | Email | Twitter

                Digging the interwebs for #MODX gems and bringing it to you. modx.link