Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2012-01-24 10:58:59

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

Re: multiple values for attribute "value" in <txp:if_variable>

That is true, and neat. I think we all are aware that one could use a user-definable separator. But to voice my opinion, I have to say, please no. Textpattern’s tag attributes selection is disordered enough as it is. Every conditional tag shouldn’t have their own syntax, but the parser should handle array of values, and every conditional tag should behave exactly the same way. I.e.

<txp:if_variable name="flavor" in:value="strawberry" in:value="blueberry" in:value="chocolate">
	No tea?
</txp:if_variable>

About the patched if_variable itself, it has minor issues. It doesn’t support empty characters (including 0) as separators. For example this fails:

<txp:if_variable name="flavor" value="1011" separator="0">
	Binary doesn't taste good.
</txp:if_variable>

I would personally set the separator NULL and then check whether it’s set. Also consider white-space, which is an issue when values are listed in a single attribute, instead of as an array of attributes. Unlike custom fields, variables are not neatly organized single line of text.

Offline

#17 2012-01-24 20:15:35

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: multiple values for attribute "value" in <txp:if_variable>

Check cbe_if_variable. It works with a list of value, or like if_custom_field (with a pattern) if you prefer.

Offline

Board footer

Powered by FluxBB