2011-04-25 60 views
0

這是我當前的同上呼叫,並且只有在模板變量中選擇了west時才起作用(模板變量是複選框)。我需要在選中多個複選框時使其工作。Modx同上呼叫和複選框

[[Ditto? &parents=`5` &depth=`1` &tpl=`map_person` &orderBy=`lastname ASC` &filter=`district,West`]] 
+0

只是爲了確認你在問什麼...區是你的電視嗎?幷包含東西,東,南,北?只有在West進行檢查時,過濾器才起作用,而不是如果檢查West和East,例如? – Fishcake 2011-04-26 10:39:32

+0

這是正確的 – josh 2011-04-26 16:34:03

回答

1

的&過濾器能夠使用領域,標準,模式,所以如果它應該只對那些誰擁有西檢查,你應該寫這方面的工作:

&filter=`West,2,1|East,1,1|South,1,1|North,1,1` 

所以最高審計機關:選擇西文檔被檢查並且East沒有被檢查並且South沒有被檢查並且North沒有被檢查。

您也可以創建一個代碼片段來完成此操作並遍歷父級= 5的子代,並將所有子代碼的逗號列表回顯出來,並將其放入&文檔參數中。事情是這樣的:

[[Ditto? &documents=`[!FindExclusive? &district=`West` &parentid=`5`!]`]] 

中的片段代碼,你可以寫這樣的事情(僅僅是僞代碼在這裏):

$children = get all children from $parentid; 
$documents = new Array(); 
foreach $children['id']{ 
    Get the checkboxes from this child 
    Check if only the $district checkbox is checked 
    if it is true then fill inn the id in $documents-array 
} 
echo implode(',',$documents); 

這將生成的文檔的逗號分隔列表,只有擁有西檢查。你可以使用東,南,北的相同片段。