Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-25 08:51:42

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

why is 1 is lesser or equal to 11 false according to TXP

Hello,

I have a code where i check if the custom field named pagenr is bigger or equal to variable named firstpage and is lesser or equal to a variable named lastpage.

This is the code.

 <txp:smd_if field="my_custom_field_pagenr,my_custom_field_pagenr" operator="le,ge" value=" '<txp variable name="firstpage" />', '<txp variable name="lastpage />'" />    

But it won't work.

Can anyone tell me why ?

Roelof

Last edited by roelof (2010-02-26 12:44:57)

Offline

#2 2010-02-25 10:39:06

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: why is 1 is lesser or equal to 11 false according to TXP

Textpattern.com / Weblog / Tag parser – part 1: new features

[…] we’ve enabled attribute value parsing for single quoted attribute values […] Double quoted attribute values are not parsed […]

Alto, the plugin, smd_if, has txpvar: operator. Ie. txpvar:firstpage.

roelof wrote:

le,ge

You sure about the order? That the value should be less than startpage, not the other way around?

Offline

#3 2010-02-25 12:54:03

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

Re: why is 1 is lesser or equal to 11 false according to TXP

Hello, Gocom,

I changed the things you point me to.
It works now but not complety right.

When i have these value’s :

Custom field (pagenr) : 1
firstpage : 1
lastpage : 11

Then the rule becomes false.
I don’t know why because 1 >=1 is right , 1 <=11 is also right.

Roelof

I did a little research and I found out that the problem is in the last part : custom_field_pagenr <= lastpage so 1 <= 11 is false according to Txp.
Ik looked into the tagtrace and this one seems always be false even if custom field and lastpage are the same number.
Very wierd.

Can anyone explain this ?

Last edited by roelof (2010-02-26 08:28:06)

Offline

#4 2010-02-26 18:12:07

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

Re: why is 1 is lesser or equal to 11 false according to TXP

Hello,

I found it my self.
I have to name it pagenr and not my_custom_field_pagenr.
Everything is working now.

Roelof

Offline

Board footer

Powered by FluxBB