It just won’t run getResources. Not anywhere. I changed to ’Input Type: Dropdown’ to keep things simple. I’m 100% sure that dropdown menu’s render okay, so I’ll first try to populate a dropdown list TV using a getResources snippet.
I tried the following:
1. Input Option Value populating by using a chunk with a snippet inside it
Input Option Value: @CHUNK pagelist
Chunk pagelist:
[[getResources? &parents=`0` &depth=`1` &limit=`3` &tpl=`TVList` &tplLast`TVListLast` &sortby=`menuindex` &sortdir=`ASC` &outputSeparator=``]]
TVList contains:
[[+pagetitle]]==[[+id]]||
TVListLast contains:
Result: an empty dropdown box
2. Input Option Value populating by using @EVAL with a snippet-call inside it
Input Option Value:
@EVAL return $modx->runSnippet('getResources', array('parents' => 0, 'depth' => 1, 'limit' => 3, 'tpl' => 'TVList', 'tplLast' => 'TVListLast', 'sortby' => 'menuindex', 'sortdir' => 'ASC', 'outputSeparator' => ''));
OR
Input Option Value: @EVAL { return $modx->runSnippet('getResources', array('parents' => 0, 'depth' => 1, 'limit' => 3, 'tpl' => 'TVList', 'tplLast' => 'TVListLast', 'sortby' => 'menuindex', 'sortdir' => 'ASC', 'outputSeparator' => '')); }
OR
Input Option Value: @EVAL echo $modx->runSnippet('getResources', array('parents' => 0, 'depth' => 1, 'limit' => 3, 'tpl' => 'TVList', 'tplLast' => 'TVListLast', 'sortby' => 'menuindex', 'sortdir' => 'ASC', 'outputSeparator' => ''));
OR
Input Option Value: @EVAL { echo $modx->runSnippet('getResources', array('parents' => 0, 'depth' => 1, 'limit' => 3, 'tpl' => 'TVList', 'tplLast' => 'TVListLast', 'sortby' => 'menuindex', 'sortdir' => 'ASC', 'outputSeparator' => '')); }
Result: an empty dropdown box
3. Input Option Value populating by using @RESOURCE with a snippet inside it
Input Option Value: @RESOURCE 21
Resource 21 (document/page) contains:
[[getResources? &parents=`0` &depth=`1` &limit=`3` &tpl=`TVList` &tplLast`TVListLast` &sortby=`menuindex` &sortdir=`ASC` &outputSeparator=``]]
Result: a dropdown box with the snippet call: '[[getResources? &parents=`0` &depth=`1` &limit=`3` &tpl=`TVList` &tplLast=`TVListLast` &sortby=`menuindex` &sortdir=`ASC` &outputSeparator=``]]''
OR
Resource 21 (document/page) contains - uncached:
[[!getResources? &parents=`0` &depth=`1` &limit=`3` &tpl=`TVList` &tplLast=`TVListLast` &sortby=`menuindex` &sortdir=`ASC` &outputSeparator=``]]
Result: a dropdown box with the snippet call: ’[[!getResources? &parents=`0` &depth=`1` &limit=`3` &tpl=`TVList` &tplLast=`TVListLast` &sortby=`menuindex` &sortdir=`ASC` &outputSeparator=``]]’
-----
If I run the above snippet calls on a page everything is fine. So my guess is that getResources does something wrong here....
----
The following setup (without getresources) DOES work:
Input Option Value: @EVAL return $modx->runSnippet(’testlist’);
testlist snippet contains the output which the getResources call above outputs when called on a normal page:
echo 'Home==1||Pagenr2==2||Pagenr3==3';
The result is how it should be, but I can’t get this to work with getResources...