Forum
Navigation
Navigation.
I want to add some navigation from my website. Its based on Boostrap. This is my current navigation:
Would it be easier to have it as a template would anyone be able to give me an example of the best way to achieve this as the docs are a little confusing for a first time user.
Thanks
Rob
The default nav template gives you more or less that structure.
Ok I have in my index.php:
In item.html
But its duplicating my navigation?
You've hardcoded your navigation into the template. Take a look at the default template we ship with Perch.
Thanks Drew
By default do you mean this code?
<perch:before> <ul> </perch:before> <li<perch:if exists="current_page"> class="selected"</perch:if><perch:if exists="ancestor_page"> class="ancestor"</perch:if>> <a href="<perch:pages id="pagePath" />"><perch:pages id="pageNavText" /></a>
<perch:pages id="subitems" encode="false" /> </li> <perch:after> </ul> </perch:after>
Yes, that's right.
Thanks Drew,
Would you be able to give me an example of how to structure my navigation, and a dropdown please.
What output are you getting, and which part of it do you need to change?
Managed to get something to work using
index.php
In item.html
It works but I am not too sure if its correct. But how do I tell perch to structure my navigation the same as the page structure shown in Perch#s backend where you organised the pages?
Thanks
Rob
Again, you're hard coding your links into the template. The template shouldn't contain any of your links - just the markup to produce them.
Its displaying the top navigation only. Can you tell me please what code would be required to get the dropdown menu to work.
Code so far:
And then I have the default code
With
'levels'=>1
you're only outputting the first level of navigation. Presumably the drop down contains the second level - so you'll need to set that to at least2
I added level 2 but it messes the navigation up as the structure is not out putted correctly.
Would I need to put any other tags in the index.php as I've tried /services for the path too and nothing happens. Only other option would be to alter the item.html but I'm not too sure what the codes doing to alter it.
Or would you recommend a second nav template ?
What output are you getting, and what should it be?
Now the static code for the dropdown in bootstrap is
So I have the dropdown working using
But it has put all my page into the dropdown. As the Blog page is a top level page.
Can you clarify what you mean by "all my page"? Do you mean all following markup is being added to the drop down? If so, that sounds like broken markup.