Textpattern Forum

You are not logged in. Register | Login | Help

#391 2012-06-07 13:16:09

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: smd_if: Generic multiple if condition tests

Hi,

I changed the field name and options to all lower case and it works (without jakob’s filter).

Not sure why.. but I’m happy :)

Thanks for your help!

Offline

#392 2012-07-26 15:29:43

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,981
Website

Re: smd_if: Generic multiple if condition tests

For the record (and maybe for the help documents too).

  • id is always the id of current page’s article (i.e. the id of current individual article)
  • thisid is the id of current context article. For example, in an article_custom loop, thisid takes the value of the article currently being iterated.

For example, if you need to simulate txp:if_article_id, using smd_if, it would be like this:

<txp:smd_if field="thisid" operator="eq" value="?id">

The advantage of this one over txp:if_article_id is that you could check for other conditions, using logic="OR".


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#393 2012-09-28 20:22:49

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,981
Website

Re: smd_if: Generic multiple if condition tests

I’m not sure if I understand how the parent value for field attribute works. I’m not even sure if I needed for what I’m trying to achieve:
Is it possible to test if current (global) category has no children? I don’t think I need to traverse up the category tree for that, but I may be missing something.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#394 2012-12-12 14:49:58

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 346

Re: smd_if: Generic multiple if condition tests

Hi, a quick question.
How I should use it if I want to know if a body or excerpt article has content or not ?

I was using <txp:chh_if_data> but it does not work / comply when the output is less than 39 characters :| (unless when I’m displaying articles from a specific category)

<txp:chh_if_data>
<txp:article_custom form="body" pgonly="0" limit="1" section='<txp:section />' sort="Posted asc" status="5" category='<txp:category title="0" />' />
<txp:else/>
<p>NO THERE CONTENT IN BODY ARTICLE</p>
</txp:chh_if_data>

Thanks

Last edited by gfdesign (2012-12-12 14:56:31)

Offline

#395 2012-12-12 19:48:53

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,047

Re: smd_if: Generic multiple if condition tests

Without plugin?

<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>

status 5 is sticky, right? (No further proofreading done.)

Last edited by uli (2012-12-12 21:19:33)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#396 2012-12-12 20:03:05

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 907

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

#397 2012-12-12 21:10:52

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 346

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

#398 2012-12-12 21:19:12

uli
Moderator
From: Cologne/Köln
Registered: 2006-08-15
Posts: 3,047

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

#399 2012-12-12 21:20:10

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 346

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

#400 2012-12-12 23:33:11

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 907

Re: smd_if: Generic multiple if condition tests

The example checks the body field.

Offline

Board footer

Powered by FluxBB