I'm using pages to add Case Studies to our site. I've been trying to modify the below UDT so that the items include the page's images. I understand that I can just use the Navigator module (which is what I've done in the past) but the reason I want to keep it as a UDT is so that I can give it some parameters like "pagelimit" and "sortorder" ( I'm hoping that the final module tag would look something like {case_studies category="commercial" pagelimit="3" sortby="DESC"}).
Code: Select all
$pagelimit = isset($params['pagelimit']) ? $params['pagelimit'] : '';
$sortby = isset($params['sortby']) ? $params['sortby'] : '';
global $gCms;
$manager =& $gCms->GetHierarchyManager();
$thisPage = isset($params['category']) ? $params['category'] : '';
$currentNode = &$manager->sureGetNodeByAlias($thisPage);
$nodes = $currentNode->getChildren();
if ($currentNode->hasChildren()) {
echo '<ul class="casestudies">';
foreach ($nodes|@array_slice:0:'.$pagelimit.' as $node) {
$content = $node->getContent();
$url = $content->GetURL();
$image = $content->GetImage(); /* THIS DOESN'T WORK */
if ($url == "#") { /* section header has no link by default */
$url = "index.php?page=".$content->Alias();
}
echo "<li><a href=\"".$url."\">".$content->MenuText()."</a> </li>";
}
echo "</ul>";
}
Thanks,
James