IF Statement with AND

gerry.odea
Posts: 98
Joined: Fri Sep 19, 2008 9:33 am

IF Statement with AND

Post by gerry.odea »

Hello,

I'm having an issue where something is not working and if you could tell me why I would appreciate it.

Here's the example
<strfmt "%at" "%m%d" "now">
<$todaysdate=$ret>

<if $todaysdate gt 0206 and $todaysdate lt 0214>
<img src="/logo-valentines.gif">
<else>
<img src="/logo.gif">
</if>


it does work when I use:
<strfmt "%at" "%m%d" "now">
<$todaysdate=$ret>
<if $todaysdate gt 0206>
<if $todaysdate lt 0214>
<img src="/logo-valentines.gif">
</if>
<else><img src="/logo.gif">
</if>

Thanks!
User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

IF Statement with AND

Post by jason112 »

You need to add parens in the if to allow anything beyond a simple comparison.

<if ($todaysdate gt 0206 and $todaysdate lt 0214)>