Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-01-21 02:47:11
- marcusyoungdog
- New Member
- Registered: 2007-01-19
- Posts: 9
conditional text based on most recent article displayed?
I’m wondering if there is a way to display text on a section page only if you are viewing the most recent article in that section. for example:
section called “cats” – when person lands on that section they get a block of text, “welcome to kitty corner! I love cats! here’s where you can get the latest on all 35 of my cats!” and below that, the most recent article, “scruffy had 5 kittens!” the user clicks to view an older article, called “scruffy is pregnant!”, and on that page the welcome text is not displayed.
is this possible?
for the record, the cat section was just an example and a bad attempt at humor… heh
Last edited by marcusyoungdog (2007-01-21 02:48:17)
Offline
#2 2007-01-21 15:07:07
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: conditional text based on most recent article displayed?
Make your welcome text a sticky article. You can show it only on the section page like this:
<txp:if_section name="cats">
<txp:if_article_list>
<txp:article status="sticky">
<txp:article limit="1" />
<txp:else />
<txp:article />
</txp:if_article_list>
</txp:if_section>
If you are going to use this for all section pages, not just ‘cats’, leave out the name="cats"
attribute. And if you are using separate page templates for your sections you can leave out the if_section tags.
Last edited by els (2007-01-21 15:09:43)
Offline