We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30319
    • 406 Posts
    I Hope I am posting to the correct forum.

    have a ’content’ template which handles all my pages.

    I’d like to vary its content according to whether someone has clicked a link from the home page, which has a resource ID #1.

    That is, if the Resource ID == 1, use a particular chunk which contains particular placeholders.
    Otherwise display a different chunk with different placeholders.

    It would be something like:

    [[!*id:if=`[[*id]]`:eq=`1`:then=`[[$foo]]`:else=`[[$bar]]`]]

    *id is for the current page, I need whatever is the way to designate the previous page’s ID to know if it was 1 or not...it’s the only source for going to the particular resource IDs involved...

    Would it be [[*parent]]?? Does this pre-defined TV exist?? I need to use the parent ID of the current ID to know what to do with this call.

    It seems like

    [[!*parent:if=`[[*parent]]`:eq=`1`:then=`[[$foo]]`:else=`[[$bar]]`]] would work??????

    This is for an announcements section, where each announcement section goes to its own announcement, whose parent ID is 1 (home).

    Thank you, Tom
      • 1778
      • 659 Posts
      Hi Tom,

      [[*parent]] does exist, it treturns the ID of the imediate parent. So your [[!*parent:if=`[[*parent]]`:eq=`1`:then=`[[$foo]]`:else=`[[$bar]]`]] should work...

      you can also do

      [[!*parent:is=`1`:then=`[[$foo]]`:else=`[[$bar]]` ]]

      Cheers
        • 17422
        • 225 Posts
        hi,

        i search a documentation for all small function same : `is` or `if` etc...

        do you know where can i find these pages ?
        • There’s this page on the Docs: http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters

          But that doesn’t show all the tiny output filters as you’re saying.

          One thing’s certain: all of them are in the code @ http://github.com/modxcms/revolution/blob/master/core/model/modx/filters/modoutputfilter.class.php
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 17422
            • 225 Posts
            Thanks a lot Mark,

            now i can work well smiley

            a good day

            Laurent
              • 12410
              • 353 Posts
              Hi guys how do I work with OR conditional please eg:

              [[!*resource:is=`1` :or`2`    :then=`hello`:else=`goodbye` ]]


              I want to say if resource id is 1 or 2 the say hello else say goodbye.
              THANKS!