Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Best way to build navigation with subnav?
Ok, I’m in deep water and I need some advice on how I should proceed.
I’m designing a two level horizontal navigation, first a thought about having sections as topnav and category’s as subnav. The problem is that I immediately stumble into is that this have no obvious way to go to the first category in each section.
As I see it I have three (3) choices:
1) Redirect of URL – Something like gbp_permanent_links might help me here right?
2) I don’t make the top nav into sections, instead I make all the subnav into sections and make the topnav dummy links to the first section in every topnav. This seems to be quite wrong to me.
3) I do a little of both, top nav is sections and first subnav equals topnav. Following subnavs is categories.
Here is how I have it right now (in code): thread
Last edited by theLostShirt (2008-02-03 21:58:59)
Offline
Re: Best way to build navigation with subnav?
As for the section nav, I think it could be done more simply. Just a single <txp:section_list />
tag could effectively replace the entire div#header. Something like:
<txp:section_list wraptag="ul" break="li" class="header" active_class="current" />
plus maybe another attribute or two if you only want certain sections or sections in a certain order.
Same thing with the subnav and <txp:category_list />
, although I’m not sure what you’re trying to do with the subnav. Do you mean you want the subnav to show different categories depending on which section you are in?
Code is topiary
Offline
Re: Best way to build navigation with subnav?
Do you mean you want the subnav to show different categories depending on which section you are in?
That is indeed what I want, and I want each section to focus on a ‘start category’. As for the txp code, it will be second to how I should build the navigation.
Last edited by theLostShirt (2008-02-04 00:36:50)
Offline
Re: Best way to build navigation with subnav?
cbs_category_list gets you section-aware category lists.
For the nav, you could do something like:
<ul> <li><a href="/section1/?c=section1_start_category">Section 1</a></li> <li><a href="/section2/?c=section2_start_category">Section 2</a></li> </ul>
Last edited by jsoo (2008-02-04 00:18:13)
Code is topiary
Offline
#5 2008-02-04 00:17:04
- nardo
- Member
- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: Best way to build navigation with subnav?
can u explain further what the secondary navigations points to? individual article pages? or article lists?
Offline
Re: Best way to build navigation with subnav?
nardo wrote:
can u explain further what the secondary navigations points to? individual article pages? or article lists?
ok, imagin this:
News
Right now
Archive
Calendar
Ski Event
Visitors
Apply for..
About
We
Staff
So news will lead to right now, ski event to visitors and about to we. Is this what you wanted to know?
That would mean that sometimes it will be a individual article, and sometimes it will lead to an list. eg right now will be like a regular blog (article list) and we will be a static page ‘single article’ (probably).
Offline
#7 2008-02-04 03:49:20
- nardo
- Member
- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: Best way to build navigation with subnav?
Oskar – have a look at this
may not be the best way, but it’s one way …
PS this plugin cbs_navigation_menu is great for generating main section list
Last edited by nardo (2008-02-04 03:54:01)
Offline
Re: Best way to build navigation with subnav?
Thanks for the reply’s all, but for now I will work with alternative number 2. Alternative 2 will make probably make me not dependant on
any plugin. (Even if I do not believe it to be the right way. )
I am still interested in which way you believe this kind of navigation should be built.
BTW: “Customizing your site’s design” – Presentation. Well that may be the right forum for this topic. Sadly it is really sleepy here, almost deadly.
Last edited by theLostShirt (2008-02-04 18:03:54)
Offline
#9 2008-02-05 00:13:09
- diniscorreia
- Member
- From: Lisbon, Portugal
- Registered: 2007-07-18
- Posts: 19
Re: Best way to build navigation with subnav?
Everytime I start a TXP project I stop to think on how to build the navigation. On the last site I did I had something similar to yours – nav and subnav to each section. I manually coded the primary nav, linking to sections, like @jsoo suggested – /section/category, since I couldn’t find another way to go to the first category in that section. On a previous project, there was such deep mess of levels, I had no other option to use dummy links and gbp_permanent_links.
But do you really need categories? You could create a form to list every article’s titles on each section (in some cases, those would be your subnav) and use gbp_permanent_links to take care of the rest.
Ah well, I guess it’s the price of not having sub-sections :( Wordpress ‘Pages’ feature is very useful ‘cause you can nest them so easily.
Offline
Re: Best way to build navigation with subnav?
diniscorreia: Thanks for the info! But as It will not be many submenu items on any page I will make them all of them as in alternativ 2. It probably will only be about 12-22 of them.
Offline
Re: Best way to build navigation with subnav?
If there is always article used by that section/category, you could use article_custom with category1 and if_different. In example:
On page:
<txp:article_custom limit="30" form="sections" sort="section asc" />
Form sections:
<txp:if_first_article><ul></txp:if_first_article>
<txp:if_different><li><txp:section title="1" link="1" /></li></txp:if_different>
<txp:if_last_article></ul></txp:if_last_article>
<txp:article limit="30" form="sub-sections" />
And in form sub-sections:
<txp:if_category><txp:category1 title="1" link="1" /><txp:else /><txp:permlink><txp:title /></txp:permlink></txp:if_category>
It’s only one way to produce something similiar, and it does have it own faults. Oh, yes. What it does? Basically it just listes all sections with article and listes category1s inside the specific section. If article has no category, it returns the title.
Last edited by Gocom (2008-02-05 00:58:31)
Offline