Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
If section = link URL
Hi, everyone.
I wonder if you might be able to spare a pair of eyes on this conundrum and point me in the right direction if I’m making a mistake.
I’m constructing a navbar. I’m using a linklist to output links using the following form:
<li<txp:if_section name="<txp:link_url />"> class="active"</txp:if_section>><a href="<txp:site_url /><txp:link_url />" title="<txp:link_url />"><txp:link_name /></a></li>
I’ve created a section with a name and title of lorem. I’ve created a link called lorem with a URL or lorem; that is to say, the URL matches the section name and title. My intended logic for the form is to add class="active" if the current section is the same as the link_url. I’ve added the title="<txp:link_url />" as a sanity check and I can confirm the title text is also lorem.
If I use the form above, the class="active" is not applied as the link_url doesn’t seem to be parsed inside the link form. This is from the debug code:
[Form: links_navbar]
<txp:if_section name="<txp:link_url />">
[<txp:if_section name="<txp:link_url />">: false]
</txp:if_section>
Is this expected behaviour, or have I broken something somewhere?
Thank you in advance, as always.
Last edited by gaekwad (2013-06-25 11:41:11)
Offline
#2 2013-06-25 12:46:37
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: If section = link URL
You’re probably mistaken to be in HTML mode as you begin the form with a li. However, you’ve put a TXP tag inside another one, hence it should be single apostrophes here:
<txp:if_section name='<txp:link_url />'>
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: If section = link URL
uli wrote:
However, you’ve put a TXP tag inside another one
That’s it. Good spot. Thank you, Uli.
Offline
Pages: 1