Created
February 18, 2011 13:05
-
-
Save rtripault/833625 to your computer and use it in GitHub Desktop.
source & explanations: http://modxcms.com/forums/index.php/topic,61271.0.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// First fetch all the children of the current resource | |
$children = $modx->resource->getMany('Children'); | |
// Check if there are any. If not, return false | |
if (!$children) { return false; } | |
// Check if there is a tpl set, if not return an error | |
$tpl = $modx->getOption('tpl',$scriptProperties,''); | |
if (!$tpl) { return 'No template given.'; } | |
// Start the output | |
$o = '<h2>[[*pagetitle]]</h2><ul>'; | |
// Look through the results... | |
foreach ($children as $child) { | |
// ... fetching the needed info... | |
$out = array( | |
'id' => $child->get('id'), | |
'pagetitle' => $child->get('pagetitle'), | |
'menutitle' => $child->get('menutitle'), | |
'longtitle' => $child->get('longtitle')); | |
// ... and adding it to the output as placeholders in the chunk | |
$o .= $modx->getChunk($tpl,$out); | |
} | |
// Don't forget to close the list | |
$o .= '</ul>'; | |
// Return the output | |
return $o; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment