Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Strange template variable equal comparison bug?

Quote Reply
Strange template variable equal comparison bug?
I faced a strange template parser problem.
I use:
<%if Add_Date eq Mod_Date%>added: '<%Add_Date%>'<%else%>modified: '<%Mod_Date%>'<%endif%>

I tried to display both Add_Date and Mod_Date content:
'2003.11.24. 17:11'
'2003.11.24. 17:11'
result is the same, but the condition is still not true.

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...

Last edited by:

webmaster33: Jan 5, 2004, 5:26 PM
Quote Reply
Re: [webmaster33] Strange template variable equal comparison bug? In reply to
If at the right side of expression we use $ sign for the tag, then will be compared correctly.
<%if Add_Date eq $Mod_Date%>added: '<%Add_Date%>'<%else%>modified: '<%Mod_Date%>'<%endif%>
This will work.

However I think, that if we allow left side to interpolate, then we should also allow the right side of the expression to interpolate, too!
So <%if Add_Date eq Mod_Date%> should be work the same way as <%if Add_Date eq $Mod_Date%>.
If we want to compare uninterpolated value, just as string, we can do that way:
<%if Add_Date eq 'Mod_Date'%> - this is not interpolated, and 'Mod_Date' is used as string
<%if Add_Date == 1998%> - this is not interpolated either, and '1998' is used as string

I've doubts that Alex will change that behaviour, but I have to express my opinion, that I don't aggree with current solution.
Somebody convince me, that the current solution is better for some reasons, than the suggested one...

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...