:-\
Hey mate - I thought it would be a reasonably easy question to answer. Hopefully you’re on Revo 2.1.1.
I thought it would be something similar to the this -
https://gist.github.com/715140. Neither the snippet there or what opengeek wrote as a comment work - they return nothing. I’m pretty sure these are meant to work, as well, you should be able to run a snippet like getResources... which doesn’t work. It *could* be a bug?
new Snippet :
$output = "";
$query = $modx->newQuery('modResource');
$query->select(array('pagetitle', 'id'));
$query->where(array('parent' => $modx->resource->get('id'), 'deleted' => false, 'published' => true));
if ($query->prepare() && $query->stmt->execute()) {
while ($row = $query->stmt->fetch(PDO::FETCH_ASSOC)) {
$output .= $row['pagetitle'] . "==" . $row['id'] . "||";
}
}
$output = trim($output, "||");
return($output);
This puts the ’pagetitle’ in the dropdown, and the selected value is the ’id’.
Make a new template variable (listbox single select) and :
@EVAL return $modx->runSnippet('yourSnippetName');
Now, hopefully a dev can comment (lol, not on my terribad code) but on perhaps why things aren’t working in the top example?