Hi there
Ok. Here is my goal: I have a snippet that lists the content of a chosen folder as small images that the user can click to se the webpage. The images are the same, exept for the one that is active. However, when you go a level deeper and choose a child of a child of a folder, I want the image to still be "active" - show the "active" image. Since im a newbee I can’t figure out how to change the snippet to make it do that. Can someone please help? You can see an example here:
http://www.produktionsdesign.dk/index.php?id=77 . Click the arrow next to "1 af 6" to go one level deeper.
Hope this makes sense.
The snippet I use looks like this:
// Usage:
// [[ContentListing?id=0]]
//
$content = "";
$root = $modx->getDocument($id , ’description’);
$content .= $root[’pagetitle’]."";
$content .= "";
function getContent($id, $modx) {
$children = $modx->getActiveChildren($id,’menuindex’,’ASC’,’id, pagetitle, description, isfolder’);
$output = "<ul class=’bot’>\n";
foreach ($children as $child) {
if($child[’id’]==$modx->documentIdentifier) {
$active="img src=’thumbs/firkant.gif’ border=’0’";
} else {
$active="img src=’thumbs/firkantHover.gif’ border=’0’";
}
if ($child[’description’]!="") {
$output .= "<li class=’botli’>";
$output .= "<a href=’index.php?id=".$child[’id’]."’><".$active.">".$child[’’]."</a>";
$output .="</li>\n";
} else {
$output .= "<li class=’botlito’>";
$output .= "<a href=’index.php?id=".$child[’id’]."’><img src=’thumbs/firkant.gif’border=’0’>".$child[’’]."</a>";
if ($child[’description’]!="") {
$output .= " - ".$child[’’];
}
$output .= "</li>\n";
$output .= getContent($child[’id’], $modx);
}
}
$output .= "</ul>";
return $output;
}
$content .= getContent($id, $modx);
return $content;