Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2011-09-12 16:25:29
- vurt
- Member
- Registered: 2010-10-22
- Posts: 50
Sticky article conditional
I need to display a single sticky article from another section on the default page. If it’s expired I need to display some other static content.
I’ve tried planting a variable in the sticky article form and then checking against it on the home page. No luck.
So far I’m stumped.
Offline
#2 2011-09-12 16:39:21
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Sticky article conditional
Does if_expired help?
Offline
#3 2011-09-12 16:58:19
- vurt
- Member
- Registered: 2010-10-22
- Posts: 50
Re: Sticky article conditional
I’ve tried it also, but it only works – as far as I know – in an article context. Anything based on expiration that works in an article context won’t work because it’s, well, expired.
Isn’t there a way to conditionally check on page whether there is an article published?
I’m also trying to avoid using any categorization/custom fields, but it may come to that.
Offline
#4 2011-09-12 17:05:39
- vurt
- Member
- Registered: 2010-10-22
- Posts: 50
Re: Sticky article conditional
Unbelievable: chh_if_data. Written in 2006 and still works.
Every time I need something for txp there’s someone out there who’s written a plugin.
Offline
Re: Sticky article conditional
vurt wrote:
Isn’t there a way to conditionally check on page whether there is an article published?
Yes, see variable and if_variable. Those two tags can basically do what chh_if_data can. I.e.
<!--
Define a new variable named 'article' and populate
it with the article tag of your likes. This variable is then used to check and output data
-->
<txp:variable name="article"><txp:artictle limit="10" form="myForm" /></txp:variable>
<!--
Check if there is an article available
-->
<txp:if_variable name="article" value="">
<!--
Nope, no article.
-->
<txp:else />
<!--
Yep, an article found, output it.
-->
<txp:variable name="article" />
</txp:if_variable>
Offline
#6 2011-09-12 18:09:45
- vurt
- Member
- Registered: 2010-10-22
- Posts: 50
Re: Sticky article conditional
That’s the kind of thing that makes me re-think what <txp:variable /> is good for. Thank you!
Last edited by vurt (2011-09-12 18:12:47)
Offline
Pages: 1