Textpattern CMS support forum

You are not logged in. Register | Login | Help

#101 2008-09-19 15:32:53

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

Re: smd_if: Generic multiple if condition tests

Thank you for the update. Works ok for me.

Offline

#102 2008-09-25 12:55:27

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: smd_if: Generic multiple if condition tests

Hello,

I have one question.
I have a url like this : http://test.tamarawobben.nl/?c=jaar1&month=2005-10
Now i wonder if with this plugin i can count the articles which are in this category and in this month.

Roelof

Offline

#103 2008-09-25 18:32:37

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,622
Website

Re: smd_if: Generic multiple if condition tests

roelof wrote:

Now i wonder if with this plugin i can count the articles which are in this category and in this month.

I don’t think so. This is a conditional plugin that takes action if one or more tests is true or not. Counting stuff is best done with another tool. Of course, once you get the result from whatever method you use to count things, then smd_if can take action if it is greater than/less than/equal to a certain value or a certain field.

Does that clarify your question, or have I misunderstood your intention?


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

#104 2008-09-25 19:00:25

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: smd_if: Generic multiple if condition tests

no, it clarify my question.

I try to find a way to make a pagination as i want it.
With this plugin i can make it but then i make some double work.
Everytime i have a month i have to type page2 etc again.
So back to the drawing table.

Roelof

Offline

#105 2008-09-27 08:42:25

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: smd_if: Generic multiple if condition tests

Hello,

Can i nest this tag.
I have this problem.
I think i can use this plugin to make a sort of pagination.

I have this problem.

When the month has 1 page , there will be no paging.
When a month has 2 or more pages, there will be paging.
And i have to mark the current page.

So i have this :

<txp:smd_if field= custom2 operator=“qt” value=2> <txp:smd_if field=custom1 operator=“qt” value=1> the url for page 1 (current) the url for page 2 else the url for page 1 the url for page 2 (current)
</txp:smd_if>
</txp:smd_if>

Can this work ?

Roelof

Sorry for the inconvience, but this doesn’t work.
In the url i can tell txp that i want to see another page but TXP doesn’t know what that page is.

Last edited by roelof (2008-09-27 12:05:55)

Offline

#106 2008-09-28 06:24:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,622
Website

Re: smd_if: Generic multiple if condition tests

roelof wrote:

Can i nest this tag.

Under TXP 4.0.6, no. It is governed by the same rules as every other tag. Under TXP 4.0.7 or later, yes, but there are problems with your smd_if syntax: the operator is "gt" (greater than) not "qt", and the ‘else’ needs to be a <txp:else/>. Also bear in mind that you can only use the words ‘custom1’ and ‘custom2’ if you have not renamed the fields in Admin->Preferences->Advanced, otherwise you must use whatever names you have assigned. And as a matter of style, the attribute values should all be in double quotes as (I think) this will be enforced from TXP 4.0.7 onwards.

But I still don’t quite understand what you are trying to achieve with this approach. I’ve seen your other posts on this topic and I’m still a bit confused since you appear to be trying to use custom1 and custom2 to indicate how many pages are in a month. That means you have to hard-code the values into each article, which is definitely not the way to do it! Does the rsx_page_number plugin help you?


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

#107 2008-09-28 10:15:57

roelof
Member
Registered: 2005-03-27
Posts: 647

Re: smd_if: Generic multiple if condition tests

Whay i trying to achieve is a pagination like this http://voorbeeld.tamarawobben.nl

Im now trying to do it with rsx_page_number but there i can’t get the url right.

Roelof

Offline

#108 2008-09-30 19:21:06

mapu
Member
From: Munich, Germany
Registered: 2004-03-16
Posts: 141

Re: smd_if: Generic multiple if condition tests

Thanks for this great plugin.

But I have one problem. Whenever I’m trying to use the begins operator I’m getting this error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING or T_VARIABLE or '$' in /path/to/textpattern/lib/txplib_misc.php(574) : eval()'d code(228) : eval()'d code on line 3

The way I’m trying to use the begins operator is like this:

<txp:smd_if field="body" operator="begins" value="Posted by">
...
</txp:smd_if>

I don’t know if I’m doing something wrong?

Offline

#109 2008-10-01 00:34:18

maxvoltar
Member
From: Machelen, Belgium
Registered: 2007-08-16
Posts: 76
Website

Re: smd_if: Generic multiple if condition tests

MattD told me this plugin might help me with my problem, but it looks like posted isn’t supported…

Last edited by maxvoltar (2008-10-01 00:34:32)


Textpattern projects: Maxvoltar, Made by Elephant, Twunch

Offline

#110 2008-10-01 02:01:30

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,251
Website

Re: smd_if: Generic multiple if condition tests

maxvoltar wrote:

MattD told me this plugin might help me with my problem, but it looks like posted isn’t supported…

Sorry maxvoltar. Looks like you could make it work if you use the svn version of textpattern and a take advantage of the new txp:variable stuff and some nested tags.

<txp:variable name="article_posted" value="<txp:posted />" />
<txp:smd_if field="txpvar:article_posted" operator="Depends on what you want to compare posted to...">

Warning: I’ve never used smd_if but from the help I think this could work. I’m sure Stef will set me straight.

Last edited by MattD (2008-10-01 02:05:13)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

Board footer

Powered by FluxBB