In MODx Evo, I would use the "GetField" snippet for a lot of things (
http://modx.com/extras/package/getfield). I primarily used it to go up the tree a certain number of levels from the current resource. I often did this in conjunction with PHx to determine if the current resource was a child, grandchild, or great grand child of a specific Resource. For example, I often had this in Evo to determine the depth of the current resource:
[+phx:if=`[[GetField? &field=`id` &parent=`1` &parentLevel=`2`]]`:is=`59`:then=`{{store_level2}}`:else=`{{store_level3}}`+]
I see in Revo there is the "getResourceField" snippet, but I'm not seeing how to determine the grandparent or great grandparent of a current Resource. My attempt is to do something like so:
-- Great Grandparent (1)
-- Grandparent (5)
--- Parent (45)
----- Child (77)
My goal would be to determine if the current resource is the grandchild of Resource 1, then output "X", but if the current Resource is a great grandchild of Resource 1, then output "Y". I'd be using MODx Revo "If" snippet of course.
[ed. note: flinx777 last edited this post 15 years, 1 month ago.]