Hello,
I came across this thread and tried to do the same to create a dynamic resource list tv to pick a resource in the manager. However, my tv keeps showing all resources of the entire site. For you the solution in this thread seems to work, so maybe you can point me in the right direction.
I'm using MODX Revolution 2.1.3-pl (traditional)
My resource list tv:
Input type: resource list
Input option values:
@EVAL return $modx->runSnippet('listChildren');
Allow blank: no
allow empty choice: no
Parents: (left blank)
Depth: 10
Include parents: no
Where conditions: (left blank)
Limit: 0
Output type: Default
My snippet listChildren:
<?php
$children = $modx->resource->getMany('Children', array('published' => '1'));
$output = '';
$list = array();
foreach($children as $child)
{
$list[] = $child->get('pagetitle').'=='.$child->get('id');
}
$output .= implode('||',$list);
return $output;
Please help me if you know what the problem is with the above!!! Thanks!!
Edit: the error log gives me two types of errors:
Error HY093 executing statement:
Array
(
[0] => HY093
[1] =>
[2] =>
)
And a lot of this one:
Error 42000 executing statement:
Array
(
[0] => 42000
[1] => 1064
[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Titel artikel==57' at line 1
)
[ed. note: michelle84 last edited this post 14 years, 10 months ago.]