参数中的ModX if语句

时间:2017-08-23 04:03:41

标签: modx modx-revolution

我是ModX革命的新手,无法弄明白。我需要显示来自url的父级页面(例如,诊所= 21),如果没有诊所,则将父母设置为列表。我有这个:

[[!getPage? 
    &elementClass=`modSnippet` 
    &element=`getResources` 
    &parents=[[!If? `[[!searchFieldClinic? &field=`clinic`]]`=`` &then=`127,106` &else=`[[!searchFieldClinic? &field=`clinic`]]`]]
    ]]

但if总是返回127,106,70,76,83,93,92,99,113,120,134,148,155,162,169,176,704,975,183

我做错了什么? 提前致谢

1 个答案:

答案 0 :(得分:0)

弄清楚自己,谢谢:)

[[!getPage? 
    &elementClass=`modSnippet` 
    &element=`getResources` 
    &parents=[[!If?
       &subject=`[[!searchFieldClinic? &field=`clinic`]]`
       &operator=`EQ`
       &operand=``
       &then=`127,106,70,76,83,93,92,99,113,120,134,148,155,162,169,176,704,975,183`
       &else=`[[!searchFieldClinic? &field=`clinic`]]`
    ]]
]]