We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52804
    • 36 Posts
    I'm trying to output a specific image size based on a grandparent ID of '73'

    This snippet returns the correct ID...

    [[!UltimateParent? &toplevel=`3`]]
    


    But how do I include this in an output modifier? - I thought this would work but it doesn't...

    <img src="[[!UltimateParent? &toplevel=`3`:notequalto=`73`:then=`[[*product_image:phpthumbof=`w=412&h=440&zc=1`]]`:else=`[[*product_image:phpthumbof=`w=412&h=440&zc=1`]]`]]" alt="[[*alias]]" />
    


    Any help appreciated. Thanks

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

      • 52804
      • 36 Posts
      Quote from: robh76 at Nov 01, 2016, 09:26 AM
      I'm trying to output a specific image size based on a grandparent ID of '73'

      This snippet returns the correct ID...

      [[!UltimateParent? &toplevel=`3`]]
      


      But how do I include this in an output modifier? - I thought this would work but it doesn't...

      <img src="[[!UltimateParent? &toplevel=`3`:notequalto=`73`:then=`[[*product_image:phpthumbof=`w=412&h=440&zc=1`]]`:else=`[[*product_image:phpthumbof=`w=412&h=440&zc=1`]]`]]" alt="[[*alias]]">
      


      Any help appreciated. Thanks

      • discuss.answer
        • 52804
        • 36 Posts
        Just answered my own question, what I really needed was the parent ID of the current resource...

        $id = $modx->resource->get('id');   $parents = $modx->getParentIds($id, 2);   $parent = $parents[0];    return $parent;


        This one returns the grand parent...

        $id = $modx->resource->get('id');   $parents = $modx->getParentIds($id, 2);   $grandParent = $parents[1]; return $grandParent;