Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-09-10 05:05:55

mericson
Member
Registered: 2004-05-24
Posts: 137
Website

if_variable not matching

My if_variable conditions don’t seem to be working, they never match the value properly. The textpattern tracing indicates it always evaluates false!

<txp:variable name="page_url" value="<txp:page_url/>"/>
<txp:if_variable name="page_url" value="/products/"/>
   <!-- this is never emitted -->
</txp:if_variable>

I have confirmed that page_url has the value: /products/ because emitting the variable to the output html.

Offline

#2 2009-09-10 05:51:03

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

Re: if_variable not matching

Hi Mark,

when nesting txp tags, use single quotes:

<txp:variable name="page_url" value='<txp:page_url/>' />

BTW, you have also txp:if_section for testing sections.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2009-09-10 19:36:45

mericson
Member
Registered: 2004-05-24
Posts: 137
Website

Re: if_variable not matching

Aha! Thanks very much for the single quotes guidance.

Using txp:if_section won’t work for me because I’m not just testing for a section, I’m trying to test for a section home. There is another thread on this topic

maniqui wrote:

Hi Mark,

when nesting txp tags, use single quotes:

<txp:variable name="page_url" value='<txp:page_url/>' />

BTW, you have also txp:if_section for testing sections.

Offline

Board footer

Powered by FluxBB