Gossamer Forum
Quote Reply
Template condition
I have defined a global, let's call it myglobal, which takes two arguments, and either returns the value 1 or 0.

I would like to use it as follows:
Code:
<%if myglobal($arg1,$arg2)%>
do something useful
<%else%>
do something even more useful
<%endif%>
However, this doesn't seem to work, it always does the "else" thing even if myglobal returns 1. I can get it working if I do
Code:
<%set a=myglobal($arg1,$arg2)%>
<%if a%>
....

Am I missing something, or is this indeed how I have to do it?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Template condition In reply to
My opinion is, that it should work as you described, should execute the "else" part, only if your sub returns false value, e.g. 0.

But if using the "set" is possible to get is work, what is the problem?
However would be fine, to get opinion of Alex, if this is a bug or not.
If this is a bug, then it should be corrected, of course.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [yogi] Template condition In reply to
Im not sure its clever enough....its clever but not that clever. I don't think Jason was trying to turn the template parser into Perl7 :)