Synopsis:
This script creates a navigation structure, that is context (section) aware, that is very configurable. My hope is that it will speed up shops with massive amounts of sections, and the loading times online, by using only the required html to build menus.
Example Output 1:
HTML Code:
<ul class="ul1"> <li class="li1_selected"><a href="x.html" class="link1">x</a> <ul class="ul2"> <li class="li2_selected"><a href="1.html" class="link2">1</a> <li class="li2"><a href="2.html" class="link2">2</a> </ul> </li> <li class="li1"><a href="y.html" class="link1">y</a></li> <li class="li1"><a href="z.html" class="link1">z</a></li> </ul>
HTML Code:
<ul class="ul1"> <li class="li1"><a href="x.html" class="link1">x</a> <ul class="ul2"> <li class="li2"><a href="1.html" class="link2">1</a> <li class="li2"><a href="2.html" class="link2">2</a> </ul> </li> <li class="li1_selected"><a href="y.html" class="link1">y</a> <ul class="ul2"> <li class="li2_selected"><a href="3.html" class="link2">3</a> <li class="li2"><a href="4.html" class="link2">4</a> </ul> </li> <li class="li1"><a href="z.html" class="link1">z</a> <ul class="ul2"> <li class="li2"><a href="5.html" class="link2">5</a> <li class="li2"><a href="6.html" class="link2">6</a> </ul> </li> </ul>
Notice the extra '_selected' css styles, around areas that are selected, and areas upstream are also marked as selected.
Prerequisites:
You'll need version 8, or 9 of actinic. I was using 8.5.1. HFUA to build this code. You're mileage may vary on older versions. It will NOT work on v7 or lower.
Features Overview:
This menu is php based and bypasses the standard Actnic blocks and loops. It's faster in some cases, when compared to default structures.
This menu requires a starting section. for most cases you'll want to use the root section, '0'. It can also be configured to as many sections deep as you require, usually, 2 is sufficient. You can also instruct the menu to force open all its trees, or even only display the sections that are required, based on the current location in the catalog. This is the setting that most people should use.
Trying it out:
TEST IT FIRST. BACK UP YOUR SHOP.
Here is a little more help with how the individual calls work, for those that want to get technical. Link.
And finally...
So, if anyone could give this a go, I'd be grateful. Some errors, enhancements or feedback please! I need to know if this causes any odd behavior in Actinic, after you have installed and got this working.
Changelog
- Updated this Navigation to support Hidden sections
- added some clever blocks to fix actinic errors
- added some css to make it look pretty.
- fixed a bug in currently selected css
- updated the code to an archive and moved it to a manageable place.
Download and Install
You can get the download, with instructions, here.
Comment