Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2010-12-16 11:21:43
- dreamer
- Member
- Registered: 2007-06-08
- Posts: 242
if section
So I’m trying to create multiple conditions for multiple sections. ie; if section A, then show this content, if section B, then show this content, etc…
Don’t think I’m doing right though:
<txp:if_section name="accessories">
<title>Custom Accessories <txp:page_title /></title>
<txp:if_section name="dresses">
<title>Dresses <txp:page_title /></title>
<txp:else />
<title>Generic Title <txp:page_title /></title>
</txp:if_section>
</txp:if_section>
Last edited by dreamer (2010-12-16 11:21:59)
Offline
#2 2010-12-16 12:01:03
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: if section
You can’t nest if_section tags.
If an article belongs to section “accessories” than it can’t belong also to section “dresses”.
I would like to show you a more appropriate example but I don’t understand what are you trying to accomplish.
Offline
#3 2010-12-16 12:17:03
- dreamer
- Member
- Registered: 2007-06-08
- Posts: 242
Re: if section
Basically, I am trying to set conditionals for my meta title. So if one section shows up, then this meta title description will appear. if another section shows up, then a different meta title will appear.
Offline
Re: if section
<txp:if_section name="accessories">
<title>Custom Accessories <txp:page_title /></title>
<txp:else />
<txp:if_section name="dresses">
<title>Dresses <txp:page_title /></title>
<txp:else />
<title>Generic Title <txp:page_title /></title>
</txp:if_section>
</txp:if_section>
Code is topiary
Offline
#5 2010-12-18 11:42:47
- ibob
- Member
- From: Finland
- Registered: 2010-06-14
- Posts: 35
Re: if section
Here’s one more solution to this if you dont want to do if_sections inside others:
<!-- Set empty variable before listing if_sections -->
<txp:variable name="section-url" value="" />
<txp:if_section name="accessories">
<txp:variable name="section-url" value="set" />
<title>Custom Accessories <txp:page_title /></title>
</txp:if_section>
<txp:if_section name="dresses">
<txp:variable name="section-url" value="set" />
<title>Dresses <txp:page_title /></title>
</txp:if_section>
<txp:if_section name="shoes">
<txp:variable name="section-url" value="set" />
<title>Shoes <txp:page_title /></title>
</txp:if_section>
<txp:if_section name="hats">
<txp:variable name="section-url" value="set" />
<title>Hats <txp:page_title /></title>
</txp:if_section>
<!-- If variable section-url not set, show generic url -->
<txp:if_variable name="section-url" value="">
<title>Generic Title <txp:page_title /></title>
</txp:if_variable>
Offline
Pages: 1