Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-09-26 18:48:15
- amavai
- Member
- Registered: 2009-08-25
- Posts: 37
Navigation menu with sections - class current - Please help!!
Hi there!
Hope that someone can help, I am a little crazy with this and I can’t find the right info in the forum..
The problem is this:
I have a form, with all my sections to navigate and works perfectly. Here is the code:
<div id=“sidebar”>
<div id=“archive”>
<ul>
<txp:section_list sections=“alimentacion-equilibrada, dietas-personalizadas, composicion-corporal, sobrepeso-obesidad, bajo-peso, dietas-embarazo, obesidad-infantil, anorexia-bulimia” include_default=“1” default_title=“Home” break=”“>
<li<txp:if_section name=’<txp:section />’> class=“current”
</txp:if_section>>
<txp:section link=“1” title=“1”/>
</li>
</txp:section_list>
</ul>
</div>
</div>
This works fine, the states hover and active are ok. But the current class is not displayed… The ouptut that I received in HTML is like this:
<li class=“current”>
<a href=“http://localhost//garbizu.dev/alimentacion-equilibrada/”>Alimentación equilibrada</a>
</li>
What I want to display is:
<li>
<a href=“http://localhost//garbizu.dev/alimentacion-equilibrada/” *class=“current”*>Alimentación equilibrada</a>
</li>
I tryed to use active_class as well and it doesn’t works… Of course, I tryed to put the class=“current” in all the imaginary places on the form but it doesn’t works too…
Problably I am missing some tag, but now I am completely lost…
Help please!!
Many thanks in advance!!
Amavai
Offline
#2 2009-09-26 19:17:58
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Navigation menu with sections - class current - Please help!!
amavai wrote:
I tryed to use active_class as well and it doesn’t works…
Did you add active_class="current"
to the <txp:section_list>
tag? It should add the class to the <a>
tag.
If it doesn’t, you can replace this:
<li<txp:if_section name='<txp:section />'> class="current" </txp:if_section>>
<txp:section link="1" title="1"/>
</li>
with
<li>
<txp:section link="1" title="1" <txp:if_section name='<txp:section />'>class="current"
</txp:if_section>/>
</li>
Offline
#3 2009-09-27 14:52:07
- amavai
- Member
- Registered: 2009-08-25
- Posts: 37
Re: Navigation menu with sections - class current - Please help!!
Hi Else,
Thank you very much for your help! Unfortunately, I still have the problem. The active_class doesn’t works and the code that you want to replace it’s not displaying the menu… I don’t know why… But I found a little tricky solution but with big consecuences… If I use the active_class and add a slash (/>) at the end of the tag, its works perfectly… but all the layout is afected and crash the rest of the web. I mean, the only thing that works is the menu!
Here is the code:
<div id="sidebar">
<div id="archive">
<ul>
<txp:section_list sections="alimentacion-equilibrada, dietas-personalizadas, composicion-corporal, sobrepeso-obesidad, bajo-peso, dietas-embarazo, obesidad-infantil, anorexia-bulimia" include_default="1" default_title="Home" break="" active_class="current"*/>*
<li <txp:if_section name="<txp:section />">
</txp:if_section>>
<txp:section link="1" title="1"/>
</li>
</txp:section_list>
</ul>
</div>
</div>
Could you please let me know if there are other way to add the acive class into de <a> tag???
Thank you again, if you want more info that can help you to resolve it , please let me know… thanks again!! many many thanks from Barcelona!
Amavai
> Colak Edit: Added bc.
Last edited by colak (2009-09-27 15:39:48)
Offline
Re: Navigation menu with sections - class current - Please help!!
amavai wrote:
What I want to display is:
<li> <a href="http://localhost//garbizu.dev/alimentacion-equilibrada/" class="current">Alimentación equilibrada</a> </li>
Have you tried:
<txp:section_list sections="alimentacion-equilibrada, dietas-personalizadas, composicion-corporal, sobrepeso-obesidad,
bajo-peso, dietas-embarazo, obesidad-infantil, anorexia-bulimia" include_default="1" default_title="Home" break="li"
wraptag="ul" active_class="current" />
Should produce the list you want.
Code is topiary
Offline
Re: Navigation menu with sections - class current - Please help!!
Hi amavai,
Try
<div id="sidebar">
<div id="archive">
<ul>
<txp:section_list sections="alimentacion-equilibrada, dietas-personalizadas, composicion-corporal, sobrepeso-obesidad, bajo-peso, dietas-embarazo, obesidad-infantil, anorexia-bulimia" include_default="1" default_title="Home" break="" active_class="current" >
<li <txp:if_section name='<txp:section />'>
<txp:section link="1" title="1"/>
</txp:if_section>>
</li>
</txp:section_list>
</ul>
</div>
</div>
Note the single quotes when using tag in tag. You also had <txp:section link="1" title="1"/>
in the wrong place I think.
> Edit: Or follow jeff’s suggestion who beat me to it:)
Last edited by colak (2009-09-27 15:47:24)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2009-09-27 16:47:29
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Navigation menu with sections - class current - Please help!!
Jeff’s solution should work. Some attributes in section_list only work in the single tag, not when it’s used as a container. This looks like one of these cases.
Offline
#7 2009-09-27 17:06:00
- amavai
- Member
- Registered: 2009-08-25
- Posts: 37
Re: Navigation menu with sections - class current - Please help!!
.
Last edited by amavai (2009-09-28 10:26:27)
Offline
Re: Navigation menu with sections - class current - Please help!!
Without seeing page source and/or tag trace it’s going to be hard to say where the problem lies. My guess is that it’s an HTML/CSS issue, not a Txp tag issue; furthermore my guess is the issue has to do with CSS positioning of the active class element.
Code is topiary
Offline
#9 2009-09-27 17:48:19
- amavai
- Member
- Registered: 2009-08-25
- Posts: 37
Re: Navigation menu with sections - class current - Please help!!
Hi everybody!!
Yes, I think that is something regarding the positioning.. What I don’t understand is why the first version of the form works fine, and Jeff’s solution is give me this error on the CSS. But anyway, changing the CSS works perfectly. After checking the browser compatibility I will really know if is true, but is seems ok..
Thank you very much community!! Hope to help other people in the future!
Amavai
Offline
Re: Navigation menu with sections - class current - Please help!!
In the first version your “current” class was not applied anywhere, so far as I can tell, and I presume that is the difference. Glad you have it working.
Code is topiary
Offline
#11 2009-10-02 09:41:57
- amavai
- Member
- Registered: 2009-08-25
- Posts: 37
Re: Navigation menu with sections - class current - Please help!!
moved to new post.
Last edited by amavai (2009-10-02 12:14:58)
Offline