We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    I currently have a project for which I’d need to have a TV storing the ID of the UltimateParent of any given document, for later use as a Ditto filter.

    Of course you can’t do something like this (too bad tongue) with the TV’s default value, since it’s not parsed :

    @EVAL [[UltimateParent? &topLevel=`2`]]


    Is it possible to achieve something like this ?
    Should I copy paste UltimateParent’s code, hardcoding the parameter after the @EVAL ?

    Thanks !
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 11975
      • 2,542 Posts
      Hi david,

      try with


      @EVAL $up_Params[’topLevel’]=2; return $modx->runSnippet(’UltimateParent’,$up_Params);

      This should do the trick.

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 6726
        • 7,075 Posts
        Great !

        It looks so easy and obvious when you write it... Man, if you keep up this way I’ll start selling your services (that is, if you’re not overworked already tongue) or hire you for training me !

        I’ll try this ASAP and report...

        PS : I owe you several rounds of beer or whatever you like drinking if you drop by Paris someday grin
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id
          • 6726
          • 7,075 Posts
          And it does (the trick) : great !

          Mucho gracias laugh
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 11975
            • 2,542 Posts
            u’re Welcome smiley

              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 6726
              • 7,075 Posts
              That’s really a nice tip, I mean now that you provided the logic, I can re-use it in other cases with other snippets... @bindings are powerful, now I can also style my links according to which section the article belongs to smiley

              Opens a lot of possibilities !

              We definitely should have those tips grouped in one place some day...
                .: COO - Commerce Guys - Community Driven Innovation :.


                MODx est l'outil id
                • 30884
                • 142 Posts
                That’s a brilliant piece of help for me too!
                  p i x e l p u s h e r e x t r o d i n a i r e
                  A x i s A n i m a t i o n . c o m