We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49300
    • 19 Posts
    I'm using an output filter to echo out scripts on certain pages. Like if a user is in the home page, then output this script. I'm using a script like this:

    [[*id:is=`1`:then=`[[$homeSript]]`]]

    Now I want to output a script on all of the child pages of a certain parent. For example I have a gallery landing page and a bunch of gallery items. How can I trigger those gallery item to display certain scripts.

    Literally, based on the output filter above, I would think that it's like this:

    [[*parent-id:is=`2`:then=`[[$gallerySript]]`]]

    But I'm not sure if that would work.

    This question has been answered by Bruno17. See the first response.

      • 4172
      • 5,888 Posts
      the placeholder for the parent-id is [[*parent]]

      so, you could try:

      [[*parent:is=`2`:then=`[[$gallerySript]]`]]


      but this does process the content of chunk galleryScript in any case and its better, to use this syntax and to have allways the else with conditional output-filters:

      [[[[*parent:is=`2`:then=`$gallerySript`:else=``]]]]


      this does process the content of the galleryScript - chunk only, when the condition returns true.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 49300
        • 19 Posts
        Thanks Bruno17

        I realized now that it is in another parent folder. My folder structure goes something like this:

        Gallery(2)
        - Cat1(20)
        - Gallery1 for Cat1
        - Gallery2 for Cat1
        - Gallery3 for Cat1
        - Cat2 (21)
        - Gallery1 for Cat2
        - etc(..)

        So in a way, the page that I really want to put the scripts into is under Cat1, Cat2, Cat3, etc... But they are all under Gallery. When I tried your script, it didn't work for me.

        Is there a script where it can detect the ultimate parent of a page?
        • discuss.answer
          • 4172
          • 5,888 Posts
          Quote from: vanduzled at Nov 04, 2014, 03:20 AM
          Thanks Bruno17
          Is there a script where it can detect the ultimate parent of a page?

          yes, its name is: UltimateParent
          http://modx.com/extras/package/ultimateparent
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 49300
            • 19 Posts
            Quote from: Bruno17 at Nov 04, 2014, 04:10 AM

            yes, its name is: UltimateParent
            http://modx.com/extras/package/ultimateparent

            Oh. I had to install it first. Ok then. I think this will solve the problem.

            Thanks for helping mate!