Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
A variable of variables
Hi, everyone.
I’d like to translate this into Textpattern logic:
I have set variables A, B and C. If one or more them output something I’d like to display some text.
I’m quite new to variable
and I’d be very grateful for feedback from anyone more experienced. If there’s a more efficient way to do what I want to do, I’m definitely interested in finding out more.
I’ve set three variables using article_custom
. My gut feeling is that if I set a forth variable (which I will call D) with a value of the first three variables (output A, B and C in sequence), that should cover me for if any of A, B or C evaluate as true.
Something like this (quick and dirty, untested, attributes are fictitious):
<txp:variable name="A" value="<txp:article_custom foo='bar' baz='foo' bar='0' />" />
<txp:variable name="B" value="<txp:article_custom foo='baz' baz='bar' bar='1' />" />
<txp:variable name="C" value="<txp:article_custom foo='foo' baz='baz' bar='2' />" />
<txp:variable name="D" value="<txp:variable name='A' /><txp:variable name='B' /><txp:variable name='C' />" />
…then loop in if_variable
to do the conditional stuff.
As I say, I haven’t had the time to test this out properly yet — is there another (better or preferred) way of doing what I want to do?
Thank you in advance.
Last edited by gaekwad (2013-03-27 16:13:44)
Offline
Re: A variable of variables
smd_if is better for this
Offline
Re: A variable of variables
Thanks, Rabah – I’ll take a look now.
Offline
Pages: 1