Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-10-12 15:33:56

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 782
Website

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

#2 2012-10-12 15:40:26

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2012-10-12 15:43:48

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2012-10-12 16:29:10

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 782
Website

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

#5 2012-10-12 16:33:32

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#6 2012-10-12 16:39:19

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 782
Website

Re: How to customize <li> in <txp:section_list> ... !?

Look above … :) … thanks ‘encore’.

Offline

#7 2012-10-12 16:47:28

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2012-10-12 16:52:39

Gocom
Plugin Author
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: How to customize <li> in <txp:section_list> ... !?

<txp:section url="1" />

Returns a functional URL to the section as dictated by any URL preferences or custom URL functions.

Offline

#9 2012-10-12 16:57:09

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: How to customize <li> in <txp:section_list> ... !?

Oh! I totally missed that attribute introduced on 4.0.7.
Good to know, thanks!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#10 2012-10-12 19:01:35

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 782
Website

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

#11 2012-10-12 19:10:02

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

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>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#12 2012-10-12 19:14:30

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 782
Website

Re: How to customize <li> in <txp:section_list> ... !?

Sorry, but than all li’s get class=“home” … !?

Offline

Board footer

Powered by FluxBB