Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#385 2012-12-12 20:03:05
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,476
Re: smd_if: Generic multiple if condition tests
Or:
<txp:if_custom_field name="body">
something
<txp:else />
other thing
</txp:if_custom_field>
Offline
#386 2012-12-12 21:10:52
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: smd_if: Generic multiple if condition tests
uli dijo:
Without plugin?
status 5 is sticky, right? (No further proofreading done.)
Yes, I use an sticky article just to describe different categories. About your code, it works! but I’ve modified it as follows:
<txp:variable name="checkcheck"><txp:article_custom form="body" limit="1" section='<txp:section />' sort="Posted asc" status="sticky" category='<txp:category title="0" />' /></txp:variable>
<txp:if_variable name="checkcheck" value="">
<p>NO THERE CONTENT IN BODY ARTICLE</p>
<txp:else/>
<txp:variable name="checkcheck" />
</txp:if_variable>
I thought I couldn’t store big chains text in a TXP variable :P
Many thanks
Offline
#387 2012-12-12 21:19:12
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,313
Re: smd_if: Generic multiple if condition tests
gfdesign wrote:
but I’ve modified it as follows:
Ah, the slash in the closing variable tag. Glad it didn’t make you stumble. Will correct that above.
I thought I couldn’t store big chains text in a TXP variable :P
Me neither, but I learnt it even spares one query.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#388 2012-12-12 21:20:10
- gfdesign
- Member
- From: Argentina
- Registered: 2009-04-20
- Posts: 401
Re: smd_if: Generic multiple if condition tests
GugUser dijo:
Or:
bq. <txp:if_custom_field name=“body”> something
<txp:else /> other thing
</txp:if_custom_field>
In this case, I’m not using custom_field
I wondered with body or excerpt texts of an article.
Regards
Last edited by gfdesign (2012-12-12 21:24:39)
Offline
#389 2012-12-12 23:33:11
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,476
Re: smd_if: Generic multiple if condition tests
The example checks the body field.
Offline
#390 2012-12-13 15:56:45
Re: smd_if: Generic multiple if condition tests
Documentation needs enhancement(s) regarding TXP core fields which can be checked via if_custom_field name="list of TXP core fields"
.
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
Offline
#391 2012-12-21 16:29:19
Re: smd_if: Generic multiple if condition tests
Can I check for article status?
Offline
#392 2012-12-21 16:35:54
Re: smd_if: Generic multiple if condition tests
wornout wrote:
Can I check for article status?
As in Live, Sticky, etc? Or as in HTTP status (200, 403, 404, …)?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#393 2012-12-21 16:37:26
Re: smd_if: Generic multiple if condition tests
As in live, sticky….
Offline
#394 2012-12-21 16:42:32
Re: smd_if: Generic multiple if condition tests
wornout wrote:
As in live, sticky….
Yes, for example:
<txp:smd_if field="article:status" operator="in" value="4/5">
LIVE OR STICKY
<txp:else />
HIDDEN, PENDING OR DRAFT
</txp:smd_if>
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#395 2013-01-16 17:28:59
Re: smd_if: Generic multiple if condition tests
How can I check the current section?
<txp:smd_if field="s" value="usate,nuove" operator="or">
This work only for the first value…
Last edited by wornout (2013-01-16 17:29:40)
Offline
#396 2013-01-16 17:56:51
Re: smd_if: Generic multiple if condition tests
wornout
Try logic="or"
instead.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline