Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How to customize <li> in <txp:section_list> ... !?
<txp:section_list active_class="active" default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="li" sections="thework,aanbod,info" />
Is it possible to customize this tag so that each <li> gets a class of the corresponding section?
Last edited by RedFox (2012-10-12 15:34:27)
Offline
Re: How to customize <li> in <txp:section_list> ... !?
What about this?
<txp:section_list active_class="active" default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="" sections="thework,aanbod,info">
<li class="<txp:section />"><a href="/<txp:section />"><txp:section title="1" /></a></li>
</txp:section_list>
Offline
Re: How to customize <li> in <txp:section_list> ... !?
Though, you will miss the active
class on that one.
You could try:
<txp:variable name="current_section"><txp:section /></txp:variable>
<txp:section_list default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="" sections="thework,aanbod,info">
<li class="<txp:section /><txp:if_variable name="current_section" value='<txp:section />'> active</txp:if_variable>"><a href="/<txp:section />"><txp:section title="1" /></a></li>
</txp:section_list>
Offline
Re: How to customize <li> in <txp:section_list> ... !?
maniqui … thanks for helping me. It looks promising, but it doesn’t work. It’s almost there I think … maybe it’s a typo … I don’t know.
[edit]
<a href="<txp:site_url />/<txp:section />">
… :)))))))))))
Last edited by RedFox (2012-10-12 16:38:25)
Offline
Re: How to customize <li> in <txp:section_list> ... !?
What does not work?
Did you try the first version I posted? Did that one work? (aside of not setting the active class for current section)
Offline
Re: How to customize <li> in <txp:section_list> ... !?
Look above … :) … thanks ‘encore’.
Offline
Re: How to customize <li> in <txp:section_list> ... !?
Good!
Although, I don’t get why it wouldn’t work without the <txp:site_url />
, as the URL output by <a href="/<txp:section />">
should still be an absolute URL.
Offline
Offline
Re: How to customize <li> in <txp:section_list> ... !?
Oh! I totally missed that attribute introduced on 4.0.7.
Good to know, thanks!
Offline
Re: How to customize <li> in <txp:section_list> ... !?
Mmm … I still have one more question. The tag I’m using now (without <txp:site_url />
):
<txp:variable name="current_section"><txp:section /></txp:variable>
<txp:section_list default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="" sections="thework,aanbod,info">
<li class="<txp:section /><txp:if_variable name="current_section" value='<txp:section />'> active</txp:if_variable>"><a href="<txp:section url="1" />"><txp:section title="1" /></a></li>
</txp:section_list>
It is working (living-heart.nl) … only it isn’t li.home but li.default … and I rather prefer li.home … for css reasons. Any help?
Last edited by RedFox (2012-10-12 19:04:11)
Offline
Re: How to customize <li> in <txp:section_list> ... !?
You could try this (a bit bloated, though).
<txp:variable name="current_section"><txp:section /></txp:variable>
<txp:section_list default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="" sections="thework,aanbod,info">
<li class="<txp:if_section name="default">home<txp:else /><txp:section /></txp:if_section><txp:if_variable name="current_section" value='<txp:section />'> active</txp:if_variable>"><a href="<txp:section url="1" />"><txp:section title="1" /></a></li>
</txp:section_list>
Offline
Re: How to customize <li> in <txp:section_list> ... !?
Sorry, but than all li’s get class=“home” … !?
Offline