Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-01-16 13:29:17

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

How to state the status of an article?

In my my article form I’d like to be able to display an arbitary piece of text depending on whether the article has the status “sticky” or not.

My understanding is that <txp:if_status> is used to test the http error code.

There doesn’t seem to be <txp:if_article_status> tag.

How do I do this?

Offline

#2 2009-01-16 13:56:22

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How to state the status of an article?


Code is topiary

Offline

#3 2009-01-16 15:12:20

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

Re: How to state the status of an article?

Many thanks – I thought that this would have been part of the core!

Offline

#4 2009-01-16 17:48:10

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How to state the status of an article?

Thinking it over, it sounds as though you don’t really need the plugin. Just use one form for sticky articles and a different form for live articles, and put the appropriate bit of text in the respective article forms.

However, if the arbitrary bit of text is the only difference between the two forms it would be better to use the plugin.


Code is topiary

Offline

#5 2009-01-16 20:04:16

douglgm
Member
From: Bristol
Registered: 2006-08-23
Posts: 182
Website

Re: How to state the status of an article?

Yes, I could use separate forms for stick and live articles – however, it seemed a little over the top to use two almost identical forms when a simple if conditional would have done.

Offline

#6 2009-01-17 08:03:56

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: How to state the status of an article?

I think that the new variable tag might be able to do what you want…

Edit: Make the link work..

Last edited by jstubbs (2009-01-17 13:13:28)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#7 2009-01-17 12:29:12

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How to state the status of an article?

Would it? How would you get at the article status?

Here’s another solution:

<txp:php>
echo $thisarticle['status'] == '5' ? 'sticky message' : 'live message';
</txp:php>

5 is the status code for sticky articles.


Code is topiary

Offline

Board footer

Powered by FluxBB