Textpattern CMS support forum

You are not logged in. Register | Login | Help

#141 2008-11-14 15:04:16

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

Re: smd_if: Generic multiple if condition tests

roelof wrote:

Can i nest it ?

You can’t nest smd_if calls under TXP 4.0.6, no. The same as all other tags. That’s partly the reason I added the in operator (see Edit in above post), so you could check multiple values without nesting. Under 4.0.7 the nesting restriction is lifted.

Last edited by Bloke (2008-11-14 15:04:36)


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

#142 2008-11-14 15:49:32

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

Re: smd_if: Generic multiple if condition tests

oke,

It’s a pity but i can live with it.
Thank you for the help en tips.

Roelof

Offline

#143 2008-11-14 16:51:04

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

Re: smd_if: Generic multiple if condition tests

Hoi Bloke,

I have a problem.

I use this in my page template :

<txp:if_section name=”,default”>
<txp:if_category name=“zwangerschap,jaar1,jaar2,jaar3,jaar4”>
<smd_if field=“urlvar:month” operator=“in” value=“2005-04”>
<txp:article limit=“1” form=“dagboek” sort=“Posted asc” />
<txp:ob1_pagination outputlastfirst =“0” outputnextprevious=“0” />
</smd_if>
<smd_if field=“urlvar:month” operator=“in” value=“2005-02, “2005-03”>
<txp:article limit=“5” form=“dagboek” sort=“Posted asc” />
</smd_if>
<txp:else />
<txp:article_custom section=“voorpagina” form=“default” />
</txp:if_category>
</txp:if_section>

But if i look in the tag trace the plugin isn’t doing one thing.
I have enabled it in the plugin sections.

Do you have any idea why nothing happens with the plugin.

Roelof

Offline

#144 2008-11-14 17:02:59

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

Re: smd_if: Generic multiple if condition tests

roelof wrote:

Do you have any idea why nothing happens with the plugin.

You need to add txp: in front of the smd_if plugin name ;-)

Sorry, I didn’t spot that when I copy n pasted your example, I’ve gone back and fixed the code in my post.

Last edited by Bloke (2008-11-14 17:05:50)


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

#145 2008-11-14 17:36:42

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

Re: smd_if: Generic multiple if condition tests

oke,

Still one problem.

I changed everything to :
bc.<txp:if_section name=”,default”>
<txp:if_category name=“zwangerschap,jaar1,jaar2,jaar3,jaar4”>
<txp:smd_if field=“urlvar:month” operator=“in” value=“2005-04”>
<txp:article limit=“1” form=“dagboek” sort=“Posted asc” />
<txp:ob1_pagination outputlastfirst =“0” outputnextprevious=“0” />
</txp:smd_if>
<txp:smd_if field=“urlvar:month” operator=“in” value=“2005-02, “2005-03”>
<txp:article limit=“5” form=“dagboek” sort=“Posted asc” />
</txpsmd_if>
<txp:else />
<txp:article_custom section=“voorpagina” form=“default” />
</txp:if_category>
</txp:if_section>

But now i get this messages :

<txp:smd_if field="urlvar:month" operator="in" value="2005-02, "2005-03">
<txp:article limit="5" form="dagboek" sort="Posted asc" /> ->  Textpattern Notice: niet bestaand tagattribuut: limit  on line 653
textpattern/lib/txplib_misc.php:653 trigger_error()
textpattern/lib/txplib_misc.php(574) : eval()'d code:14 lAtts()
textpattern/publish.php:970 smd_if()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish/taghandlers.php:2718 parse()
textpattern/publish.php:970 if_category()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish/taghandlers.php:2777 parse()
 <txp:smd_if field="urlvar:month" operator="in" value="2005-02, "2005-03">
<txp:article limit="5" form="dagboek" sort="Posted asc" /> ->  Textpattern Notice: niet bestaand tagattribuut: form  on line 653
textpattern/lib/txplib_misc.php:653 trigger_error()
textpattern/lib/txplib_misc.php(574) : eval()'d code:14 lAtts()
textpattern/publish.php:970 smd_if()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish/taghandlers.php:2718 parse()
textpattern/publish.php:970 if_category()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish/taghandlers.php:2777 parse()
 <txp:smd_if field="urlvar:month" operator="in" value="2005-02, "2005-03">
<txp:article limit="5" form="dagboek" sort="Posted asc" /> ->  Textpattern Notice: niet bestaand tagattribuut: sort  on line 653
textpattern/lib/txplib_misc.php:653 trigger_error()
textpattern/lib/txplib_misc.php(574) : eval()'d code:14 lAtts()
textpattern/publish.php:970 smd_if()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish/taghandlers.php:2718 parse()
textpattern/publish.php:970 if_category()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish/taghandlers.php:2777 parse()
 <txp:else/> ->  Textpattern Warning:   on line 983
textpattern/publish.php:983 trigger_error()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish/taghandlers.php:2718 parse()
textpattern/publish.php:970 if_category()
processTags()
textpattern/publish.php:929 preg_replace_callback()
textpattern/publish/taghandlers.php:2777 parse()
textpattern/publish.php:970 if_section()
processTags()
  ->  Textpattern Notice: De modelpagina default heeft nog geen txp:article tag  on line 474
textpattern/publish.php:474 trigger_error()
index.php:40 textpattern()


regards, 

Roelof

Last edited by roelof (2008-11-14 17:37:33)

Offline

#146 2008-11-14 17:57:38

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_if: Generic multiple if condition tests

Not sure if this is related to your problem, but there is a
</txpsmd_if> (the : is missing)
in your code


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#147 2008-11-14 19:45:34

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

Re: smd_if: Generic multiple if condition tests

Thank you,

You can see it works (http://test2.tamarawobben.nl

Roelof

Offline

#148 2008-11-15 13:53:58

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

Re: smd_if: Generic multiple if condition tests

i have another problem.

I have this url :
http://test2.tamarawobben.nl/?c=zwangerschap&month=2005-04

the next pages have this url :

http://test2.tamarawobben.nl/?pg=2&s=default&c=zwangerschap&month=2005-04

Now i thought that i can use this to determine how many articles must be on the first page.

<txp:smd_if field=“urlvar:month, urlvar:pg” operator=“in,isempty” value=“2005-04”, >
<txp:article limit=“1” form=“dagboek” sort=“Posted asc” />

<txp:ob1_pagination outputlastfirst =“0” outputnextprevious=“0” liselected=“here” />
</txp:smd_if>

But it doesn’t work.

Can you tell me why ?

Roelof

Offline

#149 2008-11-15 14:38:40

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

Re: smd_if: Generic multiple if condition tests

roelof wrote:

<txp:smd_if field=“urlvar:month, urlvar:pg” operator=“in,isempty” value=“2005-04”, >

Assuming the extra comma and space at the end of the tag isn’t making it break…

That statement says:

IF the ?month variable is 2005-04 AND the ?pg variable is defined but has no value (i.e. http://some/url?pg=) THEN show the article and ob1_pagination. Otherwise, don’t show anything.

Is that what you want to achieve?

I don’t know if you can ‘determine’ how many articles to put on the front page, since TXP determines that for you based on how many articles (in total) are in the category and the value to which you set the limit attribute.

Last edited by Bloke (2008-11-15 14:39:11)


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

#150 2008-11-15 15:18:27

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

Re: smd_if: Generic multiple if condition tests

what i want to achieve is :

If month=2005-04 and there’s no page (http://test2.tamarawobben.nl/?c=zwangerschap&month=2005-04) then show one article.
and after that i want if month=2005-04 and page=2 then show 3 articles.

I want to detirme if i have this url (http://test2.tamarawobben.nl/?c=zwangerschap&month=2005-04) or this one : http://test2.tamarawobben.nl/?pg=2&s=default&c=zwangerschap&month=2005-04.
One have a pg variable the other don’t have this.

Roelof

Offline

Board footer

Powered by FluxBB