Search code examples
modx-revolutionmodx-resources

MODX revolution: get second level children


I've got url: somesite.com/mypage?clinic=21&spec=myspecialisation

In my structure I have clinic -> parent -> final resource to sort out

I have this:

[[!getPage? 
    &elementClass=`modSnippet` 
    &element=`getResources` 
    &parents=`10,15,12`
    &resources=`-7,-8`
    &depth=`2`
    &limit=`21` 
    &pageVarKey=`page` 
    &includeTVs=`1` 
    &includeContent=`1` 
    &tpl=`pageAllDoctors` 
    &hideContainers=`true`
    &sortby=`FIELD(modResource.id, 456,331,390,491,2756,505,634,699,941,1044,1377,1436,1449,1678,1722,1711,1828,2007,2094,2184,2324,2487,2527)`
    &where=`[{"introtext:LIKE":"%[[!searchFieldClinic? &field=`spec`]]%", "AND:template:=":104}]`]]
[[+total:is=``:then=`&nbsp;&nbsp;&nbsp;&nbsp;nothing found.<br/><br/><br/>`:else=``]]

It sorts out the pages with introtext taken from url &spec=myspecialisation perfectly fine

Problem: The &parents=10,15,12 list in the getPage statement should be the list of pages that are children of the pages that are specified in clinic=21 parameter in url

How can I do that? Thanks a lot in advance.


Solution

  • &parents='21' &hideContainers='1' 
    

    You will hide children of clinic, which are parents of other resources. And maybe you should increase &depth