Textpattern Forum

You are not logged in. Register | Login | Help

#71 2008-05-22 12:43:17

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

Re: smd_if: Generic multiple if condition tests

BTW, did I mention “Awful!!” “I’m looking forward!” “Refreshing the forum list thrice a minute!” etc?


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

Offline

#72 2008-05-22 12:48:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,909
Website

Re: smd_if: Generic multiple if condition tests


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#73 2008-05-22 14:57:31

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,399

Re: smd_if: Generic multiple if condition tests

Bloke,
Thanks for the plugin, but just a little note: if I use the plugin tag with the urlvar attribute like this:

<txp:smd_if field="urlvar:something" operator="eq" value="something_else" >
do something
</txp:smd_if>
<txp:smd_if field="urlvar:something" operator="undefined">
do something else
</txp:smd_if>

all is working ok but in debug mode I have a series of warnings like “Notice: Undefined index: something” when the variable is missing from the URL line.
Nothing really important as the warning goes away in live mode… just wanted to let you know.

Offline

#74 2008-05-22 15:02:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,909
Website

Re: smd_if: Generic multiple if condition tests

redbot wrote:

if I use the plugin tag with the urlvar attribute… in debug mode I have a series of warnings

Yes, I’ve been meaning to fix those. Thanks for reminding me. I think it’s related to the ghost’s findings and there are a few other little things I’ve found in the last month or so that need attention.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#75 2008-05-25 02:24:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,909
Website

Re: smd_if: Generic multiple if condition tests

New version that addresses the problem mentioned in the last post and (hopefully) fixes the_ghost’s chh_if_data woes.

V0.6 [ compressed ] also adds the following features:

  • Support for files and links as well as articles so now you can embed smd_if inside the plainlinks or files forms and make decisions on which files/links to display
  • Parent checking on file and link categories has been enabled
  • Added ends operator to test if a variable ends with a particular sequence of characters
  • Added more is operators: isalpha, isalnum, islower, isupper, ispunct and isspace. Also added a :NOSPACE modifier to most of these, which suppresses spaces in the field when performing tests
  • Expanded the list of article variables to include author, month, page (the Page template currently in use), permlink_mode and next_utitle / prev_utitle (to get the next/prev url-titles)

Post any questions, comments, cool usages here as always, and have fun.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#76 2008-05-25 09:48:36

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,399

Re: smd_if: Generic multiple if condition tests

Thanks Bloke, you rule!

Offline

#77 2008-05-26 10:02:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,909
Website

Re: smd_if: Generic multiple if condition tests

Bah! Fixed a stupid oversight when generating the field names. Now, if you specify a field that doesn’t exist on the page it uses the value exactly as you specified instead of trying to find the bogus entry in $thisarticle.

That opens up even more devious tests so you can now do stuff like this inside smd_gallery:

<txp:smd_if field="{counter}" operator="gt" value="5">
  // Only display thumbs from the 6th one onwards
</txp:smd_if>

Very useful for singling out individual thumbs or only doing stuff on the 1st thumbnail, etc. Many thanks to Joana Carvalho for leading me to this fix as I tried to help her bend smd_gallery into rendering a stylish portfolio site.

V0.61 [ zipped ]


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#78 2008-06-12 00:51:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,909
Website

Re: smd_if: Generic multiple if condition tests

Another maintenance release that fixes the occasional false positive if the plugin generates an empty eval() string. Also added a new field type called NULL which is useful when comparing the result of replacement variables in smd_gallery, wet_for_each_image or smd_each (which is imminent I hope; in final testing now).

Try v0.62 | zipped


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#79 2008-07-05 14:05:38

sirblackheart
New Member
Registered: 2008-07-04
Posts: 7

Re: smd_if: Generic multiple if condition tests

Great plugin.

Only a little problem, “or” i’m only missing something?

<txp:smd_if field=“urlvar:p1” operator=“undefined , not” value=” , 1_asc” logic=“or”>
</txp:smd_if>

Shouldnt this tag write it’S content in the case, the urlvar isn’t set “or” the urlvar “p1” hasn’t the value “1_asc” ?
Seperated from each other this operators work, but they don’t seem to do in this way.
What am I doing wrong? Thx

edit:
sorry I found my error, i have to type the field two times… sorry

Last edited by sirblackheart (2008-07-05 14:39:22)

Offline

#80 2008-07-22 22:45:15

visualpeople
Member
From: Corvallis, Oregon - USA
Registered: 2005-11-16
Posts: 70
Website

Re: smd_if: Generic multiple if condition tests

I have a feeling I’m missing something easy here, so maybe all I need is another set of eyes…

I just upgraded to 4.0.6 and I swear this error wasn’t there before I ran the update, but I made a couple of other changes (I can’t recall exactly what I did, but it should have been unrelated) in the past few minutes and suddenly I noticed Tag error: <txp:smd_if field="urlvar:brand, urlvar:size, urlvar:price" operator="contains, contains, contains" value="?brand, ?size, ?price" logic="or"> -> Warning: strpos() [function.strpos]: Empty delimiter. on line 1

Here’s my form:

<txp:smd_if field="urlvar:brand, urlvar:size, urlvar:price" operator="contains, contains, contains" value="?brand, ?size, ?price" logic="or">
<tr>
<td><txp:asy_wondertag><txp:upm_article_image type="thumbnail" url="<txp:article_id/>" /></txp:asy_wondertag></td>
<td><txp:permlink><txp:title /></txp:permlink></td>
<td><txp:custom_field name="brand"/></td>
<td><txp:custom_field name="size"/></td>
<td><txp:custom_field name="price"/></td>
<td><txp:body /></td>
</tr>
</txp:smd_if>

I’ve gone over things several times, and everything seems to be outputting correctly, the error is just throwing me off… I just know I’m missing something dumb <excuse>we have a new baby in the house and I think his presence is eating my brain cells or at least severely inhibiting their function</excuse>

Offline

Board footer

Powered by FluxBB