Auto-Nav Template
Permalink
Hi I have an auto nav template which I have built which is styled to my liking but I cannot figure out where in my view.php to state the current class for my LI can any one help?
CSS:...
PHP: ...
CSS:...
#nav { margin: 0; padding: 7px 6px 0; line-height: 100%; border-radius: 2em; -webkit-border-radius: 2em; -moz-border-radius: 2em; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .4); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .4); background: #8b8b8b; /* for non-css3 browsers */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a9a9a9', endColorstr='#7a7a7a'); /* for IE */ background: -webkit-gradient(linear, left top, left bottom, from(#a9a9a9), to(#7a7a7a)); /* for webkit browsers */ background: -moz-linear-gradient(top, #a9a9a9, #7a7a7a); /* for firefox 3.6+ */ border: solid 1px #6d6d6d; }
Viewing 15 lines of 135 lines. View entire code block.
PHP: ...
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $aBlocks = $controller->generateNav(); global $c; if ($c->isEditMode()) { echo(" <ul id=\"nav\">"); } else { echo(" <ul id=\"nav\">"); } $nh = Loader::helper('navigation'); foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject();
Viewing 15 lines of 63 lines. View entire code block.
Thanks for the reply
I have a current class for the LI which highlights the link to show if its the current page or not .current. and thats what I am trying to work out in the menu, also my sub <ul>'s and <li>'s aren't working either.
I am a newb to this and I am pulling my hair out! ;)
Thanks again
Justin
I have a current class for the LI which highlights the link to show if its the current page or not .current. and thats what I am trying to work out in the menu, also my sub <ul>'s and <li>'s aren't working either.
I am a newb to this and I am pulling my hair out! ;)
Thanks again
Justin
I believe the autonav already uses a class for the current page .nav-selected or .nav-page-selected or are you trying to do something else?
Add after
if (!$_c->getCollectionAttributeValue('exclude_nav')) {
And instead of
echo '
<li><a href="'.$pageLink.'">' . $ni->getName();
if (!$_c->getCollectionAttributeValue('exclude_nav')) {
if ($ni->isActive($c) || strpos($c->getCollectionPath(), $_c->getCollectionPath()) === 0) { $navSelected='current'; } else { $navSelected = ''; }
And instead of
echo '
<li><a href="'.$pageLink.'">' . $ni->getName();
Thanks Ninja!
is this right?
is this right?
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $aBlocks = $controller->generateNav(); global $c; if ($c->isEditMode()) { echo(" <ul id=\"nav\">"); } else { echo(" <ul id=\"nav\">"); } $nh = Loader::helper('navigation'); foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject();
Viewing 15 lines of 62 lines. View entire code block.
I think so, checking out if it works?
Or am I missing something?