Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-11-30 10:30:08
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Using if variable instead of if data plugin?
I heard you can use the if variable tag instead of the if data plugin. How is this done?
Offline
Re: Using if variable instead of if data plugin?
<txp:variable name="has_output" value='<txp:article_custom id="22" />' />
<txp:if_variable name="has_output">
<p>There is article with id=22</p>
<txp:else />
<p>No article with id=22</p>
</txp:if_variable>
The idea, i think, is clear. For chacking large code snippets, you can use forms in variable name
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Using if variable instead of if data plugin?
I’m not sure that would work Victor. You need to check the “value”. Something like this does work though cuz I’m using it:-
<txp:variable name="website" value='<txp:comment_web />' />
<txp:if_variable name="website" value="">
<txp:else />
<dt><span>Website</span></dt>
<dd><a href="http://<txp:comment_web />"><txp:comment_web /></a></dd>
</txp:if_variable>
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Offline
Re: Using if variable instead of if data plugin?
It may be for the <txp:variable />
tag but you still need to check the “value” in the <txp:if_variable>
tag, in other words using Victor’s example:-
<txp:variable name="has_output" value='<txp:article_custom id="22" />' />
<txp:if_variable name="has_output" value="">
<p>No article with id=22</p>
<txp:else />
<p>There is article with id=22</p>
</txp:if_variable>
Last edited by thebombsite (2008-11-30 16:35:25)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: Using if variable instead of if data plugin?
thebombsite wrote:
It may be for the <txp:variable /> tag but you still need to check the “value” in the
It still is unset by default, (note: i just said it is unset, nothing more :D) atts
array’s value
-index returns unset, if it ain’t set. What will you think it will return if it is checked with isset()
? False or true? ;)
Edit. And, yes I meant the if_variable, plus I did not disagree in anyhow with you ;D
Last edited by Gocom (2008-11-30 16:54:09)
Offline