Skip to content

Instantly share code, notes, and snippets.

View ideesimple's full-sized avatar

Laurent Toulemonde ideesimple

View GitHub Profile
@ideesimple
ideesimple / gist:725002
Created December 2, 2010 08:51
snippet FirstChildRedirect
$docid = (isset($docid))? $docid: $modx->documentIdentifier;
$children= $modx->getActiveChildren($docid, 'menuindex', 'ASC');
if (!$children === false) {
$firstChild= $children[0];
$firstChildUrl= $modx->makeUrl($firstChild['id']);
} else {
$firstChildUrl= $modx->makeUrl($modx->config['site_start']);
}
return $modx->sendRedirect($firstChildUrl);
@EVAL return $modx->runSnippet('getAside',array("idRessource" =>"147"));