Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-04-21 13:23:21

MyKE
New Member
Registered: 2012-07-15
Posts: 3

Exclude section

Hello,

I want to display sections, If you are on current section it must have class=“current”. I have almost done it but now I have problem with selected “current” which is duplicated. Maybe code will say more:

Right HTML code:

<nav>
<ul id=“nav”>
<li><a href=“index.html” *class=“current”*>Home</a></li>
<li><a href=“articles.html”>Articles</a></li>
<li><a href=“contacts.html”>Contact</a></li>
</ul>
</nav>

And I have in TXP language this:

<nav>
<ul id=“nav”>
<txp:section_list default_title=’<txp:text item=“home” />’ include_default=“1” wraptag=”“ break=”“>
<li>
<txp:if_section name=’<txp:section />’><txp:if_search><txp:else /><txp:if_category><txp:else /><txp:if_author><txp:else /></txp:if_author></txp:if_category></txp:if_search>
<txp:section title=“1” link=“1” class=“current”/></txp:if_section>
<txp:section title=“1” link=“1” />
</li>
</txp:section_list>
</ul>
</nav>

Textpattern shows what I want – sections and current has in <a href class=“current”> but problem is with current section because it’s duplicated, one is Okay = current and second which I don’t want = duplicated not current. Is there solution how to exclude not current duplicated section?

I hope that you understand and help me. Thank you.

Offline

#2 2013-04-21 14:17:23

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Exclude section

<nav>	
	<ul id="nav">
		<txp:section_list break="" form="nav-sections" />	<!-- With the attributes that you need. -->
	</ul>
</nav>

Details for section_list

And in the form nav-sections:

<li<txp:if_section name='<txp:section />'><txp:if_individual_article>><a class="current" href='/<txp:section />'><txp:section title="1" /></a><txp:else /> class="current"><txp:section title="1" /></txp:if_individual_article><txp:else />><a href='/<txp:section />'><txp:section title="1" /></a></txp:if_section></li>
¶

Replace the ¶ with a linebreak.

Offline

Board footer

Powered by FluxBB