Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-08-13 19:55:50
- Charlie Chalk
- Member
- Registered: 2005-09-06
- Posts: 51
Can't seem to get if_section to work
Hi All
I’ve been happily coding away my site, everything going more or less as it should.
I then come to add certain header graphics depending on the section the page is in. No problem thinks I, this is a case for if_section.
I’ve coded if_section name=“Gallery” added a link to the Gallery header image and ended it with the approproate /if_section tag.
No matter what I do I can’t get it to work.
I’ve tried it in a page, and tried it in an article but nothing. No code apears on the page, nowt, nothing, nada.
I’m sure I’ve missed something really obvious, but I can’t think what it is.
Can anyone offer any pearls of wisdom?
Thanks
CC
Offline
#2 2007-08-13 21:30:00
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Can't seem to get if_section to work
Can you show the code that you tried and doesn’t work? The attribute name should have the exact section name, not the title, so for instance if your section Gallery has title Gallery and name gallery, your tag is not correct.
What also can be a problem, is if you have set permanent link mode to /title. That way the section won’t appear in the URL and if_section won’t work.
Offline
#3 2007-08-13 22:31:06
- Charlie Chalk
- Member
- Registered: 2005-09-06
- Posts: 51
Re: Can't seem to get if_section to work
Hi Els
Permalink mode is set to /section/title
<txp:if_section name="Gallery">
<p>blah blah</p>
</txp:if_section>
Section name is Gallery, I’ve also tried gallery to make sure.
I’ve checked and double checked the name, re-written the txp conditional and still no joy. It’s very frustrating as I’m sure I’ve entered it correctly. I was hoping there might be something I’ve set (like the /title you mentioned) incorrectly that would fix this, but I can’t think what it might be.
CC
Offline
#4 2007-08-14 14:45:03
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Can't seem to get if_section to work
Charlie Chalk wrote:
<txp:if_section name="Gallery"> <p>blah blah</p> </txp:if_section>
If this is in the page template it should work. The conditional looks for Gallery in the url, is it there? Or is it possible that your section Gallery uses another page template? You can also try changing the section name to ‘gallery’ (all lowercase), uppercase in section and category names can sometimes cause trouble.
If none of this helps, post a tag trace.
Offline
Pages: 1