Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-22 18:48:11

mattmikulla
Member
From: Nashville Tennessee
Registered: 2004-08-25
Posts: 281
Website

Conditional logic for section front, category, and individual article

It seems that there are 3 views within a section that textpattern can output.

Section front – /section/
Section/Category – /section/category/
Individual article – /section/individual-article

What is the best logic to use to output different content for each?

I’ve tried the following but I’m not sure it’s ideal:

<txp:if_category>
( Category Content /section/?c=categoryname )
<txp:else />
<txp:if_individual_article>
( /section/individual-article )
<txp:else />
( /section/ )
</txp:if_individual_article>
</txp:if_category>


Art Rogue – Fine Art Photography

Offline

#2 2010-04-22 21:55:37

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Conditional logic for section front, category, and individual article

mattmikulla wrote:

I’ve tried the following but I’m not sure it’s ideal

Why not? I always start with if_individual_article (because there are more article list options) but I don’t know if that is better.

BTW there may be setups where you’d need to add if_search and if_author ;)

Offline

#3 2010-04-22 22:33:09

mattmikulla
Member
From: Nashville Tennessee
Registered: 2004-08-25
Posts: 281
Website

Re: Conditional logic for section front, category, and individual article

I guess I was wondering if it is still necessary to nest the conditionals like I presented. I just jumping into txp for the first time in a few years and was wondering if there is an ideal setup for logic.


Art Rogue – Fine Art Photography

Offline

Board footer

Powered by FluxBB