Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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
Member
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: 11,462
Website GitHub

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

#151 2008-11-15 15:47:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,462
Website GitHub

Re: smd_if: Generic multiple if condition tests

roelof wrote:

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.

Then you’ll need something like:

<txp:smd_if field="urlvar:month, urlvar:pg" operator="eq,undefined" value="2005-04">
 // Show one article here
<txp:else />
  // Show 3 articles here
</txp:smd_if>

EDIT: but also remember that the ‘else’ will be executed if the month variable is something other than 2005-04

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


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

#152 2008-11-15 18:01:08

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: smd_if: Generic multiple if condition tests

OK, this is interesting….

I routinely use mdp_calendar to build cals on installs…

One of the problems I have is that a link from a small calendar will lead to a date based url. I have not found a way to gracefully distinguish between a single article and an article list (one event that day or two.) So that if it’s a single article it displays <txp:body/> and if it’s a list display <txp:excerpt/>.

The best I’ve come up with is to always display the first article in full and thereafter as excerpts.

Any other Text-Fu? Come on chumpus, go purple.

Offline

#153 2008-11-15 19:03:31

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

Re: smd_if: Generic multiple if condition tests

oke,

If i understand it right :

if month=“2004-05” and pg is not defined or pg=1

i do this :

<txp:smd_if field=“urlvar:month, urlvar:pg, urlvar:pg” operator=“eq,undefined,eq” logic=“and”,“or” value=“2005-04”,“1”>

Roelof

Offline

#154 2008-11-15 19:26:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,462
Website GitHub

Re: smd_if: Generic multiple if condition tests

roelof wrote:

<txp:smd_if field=“urlvar:month, urlvar:pg, urlvar:pg” operator=“eq,undefined,eq” logic=“and”,“or” value=“2005-04”,“1”>

Nope. You can only do one type of logic at a time, sorry. You have to choose either AND (the default) or logic="or" to switch it. I did consider allowing multiple logic types (see an earlier post by the_ghost) but it was very complicated and I abandoned the idea. Especially since nested smd_if calls are going to be allowed in TXP 4.0.7.

Under TXP 4.0.6, what you are trying to do is pretty tricky and I can’t think of a way of doing it without resorting to some <txp:php> inside the <txp:smd_if> tag.

mrdale

Interesting indeed, but bad news for you as well: I can’t find a variable anywhere on the page that would allow me to test that condition. If it ain’t on the page, I can’t check it :-(

I wondered if $thispage had anything useful (like, if the calendar used it to store the total number of results that matched the current date) but for some reason I can’t even display the contents of it on my SVN test site; I just get back NULL all the time. Clearly I don’t understand what it does, despite trying this! I’ll delve a bit deeper, but at the moment it’s no no mojo from the chumpstick right now.

Last edited by Bloke (2008-11-15 19:27:35)


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

#155 2008-11-15 20:05:29

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: smd_if: Generic multiple if condition tests

chumperoo> Thanks. You are a man among chumps, indeed.

Offline

#156 2008-11-15 20:45:12

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

Re: smd_if: Generic multiple if condition tests

Hello Bloke,

Thank you for your time.
If this is not possible it no big deal.

Roelof

Offline

Board footer

Powered by FluxBB