Autonav template with image creates strange HTML
Permalink
Hi, I am using the default template for custom classes and added a custom attribute for a image per menu item in it but it generates strange HTML output. What am I doing wrong?
echo '<ul class="nav">'; //opens the top-level menu foreach ($navItems as $ni) { $image = $ni->cObj->getAttribute('nav_item_image'); if ($image){$image_url = $image->getURL();} else {$image_url = 'noimage.jpg';} } echo '<li class="' . $ni->classes . '"><img src="' . $image_url . '" class="nav_icon" />'; //opens a nav item if ($ni->isEnabled) { echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $ni->name . '<i class="fa ' . $ni->attrClass . '"></i></a>'; } else { echo '<span class="' . $ni->classes . '">' . $ni->name . '</span>'; } if ($ni->hasSubmenu) { echo '<ul>'; //opens a dropdown sub-menu } else {
Viewing 15 lines of 20 lines. View entire code block.
I find a css method using an image sprite to be much lighter on resources.
An example of which can be seen on this 5.6 site...
http://www.deepsea.co.uk/