Create image based menu
Permalink
Is it possible to replace the C5 created text menu with an image and link to relevant pages? If so, clues as how to do this please. Thanks
Worked through tutorial but failed at modifying the image_navigation.php file. Could not quite understand the instruction about from line 55!!
My code looked like this at the end and did not work. Any hints please?
I am working with theme Freshmedia.
$linkTextActive = $ni->getName();
$linkTextInactive = $ni->getName();
$picOn = $_c->getAttribute('pic_on');
$picOff = $_c->getAttribute('pic_off');
if ($picOn) {
$linkTextActive = '<img src="' . $picOn->getURL() . '" alt="' . $linkTextActive . '"/>';
}
if ($picOff) {
$linkTextInactive = '<img src="' . $picOff->getURL() . '" alt="' . $linkTextInactive . '"/>';
}
if ($c->getCollectionID() == $_c->getCollectionID()) {
echo('<li class="nav-selected nav-path-selected"><a class="nav-selected nav-path-selected" href="' . $pageLink . '">' . $ni->getName() . '</a>');
} elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) ) {
echo('<li class="nav-path-selected"><a class="nav-path-selected" href="' . $pageLink . '">' . $ni->getName() . '</a>');
} else {
echo('<li><a href="' . $pageLink . '">' . $ni->getName() . '</a>');
}
$lastLevel = $thisLevel;
$i++;
}
}
$thisLevel = 0;
for ($i = $thisLevel; $i <= $lastLevel; $i++) {
echo("</li></ul>");
}
?>
My code looked like this at the end and did not work. Any hints please?
I am working with theme Freshmedia.
$linkTextActive = $ni->getName();
$linkTextInactive = $ni->getName();
$picOn = $_c->getAttribute('pic_on');
$picOff = $_c->getAttribute('pic_off');
if ($picOn) {
$linkTextActive = '<img src="' . $picOn->getURL() . '" alt="' . $linkTextActive . '"/>';
}
if ($picOff) {
$linkTextInactive = '<img src="' . $picOff->getURL() . '" alt="' . $linkTextInactive . '"/>';
}
if ($c->getCollectionID() == $_c->getCollectionID()) {
echo('<li class="nav-selected nav-path-selected"><a class="nav-selected nav-path-selected" href="' . $pageLink . '">' . $ni->getName() . '</a>');
} elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) ) {
echo('<li class="nav-path-selected"><a class="nav-path-selected" href="' . $pageLink . '">' . $ni->getName() . '</a>');
} else {
echo('<li><a href="' . $pageLink . '">' . $ni->getName() . '</a>');
}
$lastLevel = $thisLevel;
$i++;
}
}
$thisLevel = 0;
for ($i = $thisLevel; $i <= $lastLevel; $i++) {
echo("</li></ul>");
}
?>
How would the code look for an image for each subsequent page link??
Sorted some of the coding problem and have an image on the home page, but no Inactive state. I currently have only 3 pages on the test site, but may have up to 5 options for header menu bar. It's how I do this and have all 5 also available on subsequent pages that I am trying to figure out.
Regards
Regards
http://www.codeblog.ch/2009/12/image-navigation-items/...