Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Basic navbar question...
I’m using a template to build a new Textpattern-based site. There will be three tabs in the horizontal (list-based) navbar.
Currently, each of the pages – Tab 1, Tab 2 and Tab 3 use the same “default” page. However, when I visit Pages 2 & 3, the navbar still has Tab 1 “highlighted” as the active page.
Must I create separate pages for Tabs 2 & 3 just to be able to style the navbar tabs appropriately?
Thanks.
“Well, I, uh, don’t think it’s quite fair to condemn a whole program because of a single slip-up, sir.” General ‘Buck’ Turgidson
Offline
Re: Basic navbar question...
there is a plugin which recognises the selected items… I forgot which one. Maybe someone here will point you to it.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Basic navbar question...
I dunno about template, but put a different class in the body tag and use a selector.
<code>
<body class=“homepage”>
</code>
<code>
.homepage li#hplink a, .aboutpage li#aplink a {
(styles for page you’re on)
}
</code>
Offline
Re: Basic navbar question...
Thanks for the help, Walker, but I believe your solution works only if the pages for Tab 1, Tab 2 and Tab 3 are literally separate pages in Textpattern. Currently, I have one page called “default” with a separate section for each Tab.
The styling for the navbar uses syntax like [li class=“selected”] with the highlighting of the “selected” navigation button provided by CSS. However, each of the other tabs seems to require a separate page so that the particular list item for that page can carry the class “selected.” Am I wrong about this?
“Well, I, uh, don’t think it’s quite fair to condemn a whole program because of a single slip-up, sir.” General ‘Buck’ Turgidson
Offline
Offline
Offline
#7 2006-06-21 14:54:07
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Basic navbar question...
No, you don’t need separate pages. So every tab is a section? I think it must be possible to change the code to something like this:
<code>
<li <txp:if_section name=”“>class=“selected”</txp:if_section>>Tab 1</li>
<li <txp:if_section name=“section2”>class=“selected”</txp:if_section>>Tab 2</li>
<li <txp:if_section name=“section3”>class=“selected”</txp:if_section>>Tab 3</li>
</code>
Offline
Re: Basic navbar question...
…or you could just use rdt_dynamenus
which let’s you build a dynamic menu based on sections. I use it all the time.
Offline
Re: Basic navbar question...
Els wrote:
No, you don’t need separate pages. So every tab is a section? I think it must be possible to change the code to something like this:
<code>
<li <txp:if_section name=”“>class=“selected”</txp:if_section>>Tab 1</li>
<li <txp:if_section name=“section2”>class=“selected”</txp:if_section>>Tab 2</li>
<li <txp:if_section name=“section3”>class=“selected”</txp:if_section>>Tab 3</li>
</code>
Tough day here! This junk takes FOREVER to troubleshoot and fix.
Here’s the site I’ve been working on. For some reason the “home” button doesn’t highlight when Home is the displayed page, but Els’s suggestions solved the navbar issue on the other two pages. Thanks.
“Well, I, uh, don’t think it’s quite fair to condemn a whole program because of a single slip-up, sir.” General ‘Buck’ Turgidson
Offline
#10 2006-06-21 17:43:59
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Basic navbar question...
I just realized: you’d better move the space after ‘li’ to inside the conditional tag, like this:
<li<txp:if_section name=""> class="selected"</txp:if_section>>Tab 1</li>, otherwise if there is no class you end up with a space that shouldn’t be there (<li >). Though it seems to validate just fine.
But I don’t understand why when on the home page no class is added to the <li>. Are you sure there is no typo?
Offline
Re: Basic navbar question...
Els wrote:
Are you sure there is no typo?
Again, I appreciate your help. Here’s the code for the navbar:
<code>
<li<txp:if_section name=“Default”> class=“selected”</txp:if_section>><a href=“http://itworx.net”>Home</a></li>
<li<txp:if_section name=“about”> class=“selected”</txp:if_section>><a href=“http://itworx.net/about/”>About</a></li>
<li<txp:if_section name=“services”> class=“selected”</txp:if_section>><a href=“http://itworx.net/services/”>Services</a></li>
</code>
“Well, I, uh, don’t think it’s quite fair to condemn a whole program because of a single slip-up, sir.” General ‘Buck’ Turgidson
Offline
#12 2006-06-21 18:33:57
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Basic navbar question...
Don’t use name="default". It should be name="".
Last edited by els (2006-06-21 18:34:19)
Offline