Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
A first TXP Plugin: nab_if_future
Hi all,
Partly to learn about writing TXP plugins and how plugins work, I wrote a very simple one that I had a use for. It allows you to display content based on whether the article is set to post in the future.
For example, in an article form called by <txp:article time="any" />
, you could have:
<txp:nab_if_future>
<txp:excerpt />
<txp:else />
<txp:body />
</txp:nab_if_future>
Offline
#2 2009-08-30 21:17:41
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: A first TXP Plugin: nab_if_future
Neat!, next update you might pop in a call to assert_article(); right after the global declaration, against that occasion when an attempt is made to use the tag outside an article or single article mode context.
Offline
Re: A first TXP Plugin: nab_if_future
Thanks Rick! Will do. If I add assert_article(), do I still need to declare the global $thisarticle? – I see that line within the assert_article() function.
Offline
Re: A first TXP Plugin: nab_if_future
Hi Nora
I’m getting a 404 for that link – is this one still available?
Stu
Offline
Re: A first TXP Plugin: nab_if_future
Should be up now! I changed hosts from aplus.net to hostgator in a fit of frustration, and I guess I forgot to upload the plugins folder. Sorry about that!
Offline
Re: A first TXP Plugin: nab_if_future
Indeed it is. Thanks, and nice work :-)
Offline
Pages: 1