XF 1.1 Change details via date?

DaveL

Well-known member
Hi,

I currently use the code below to display different text/image art different times of the day.

Code:
<xen:if is="{xen:time $serverTime, 'G:i'} >= '00:00' AND {xen:time $serverTime, 'G:i'} < '01:30' AND {xen:time $serverTime, 'D'} == 'Mon'">
<a href="{$xenOptions.boardUrl}/pages/OnAir__StephenKennett"><img src="{$xenOptions.boardUrl}/images/presenters/DSCF1157.jpg" style="width: 180px; height:155px; margin-bottom: 5px;"></a><br><a href="{$xenOptions.boardUrl}/pages/OnAir__StephenKennett">Stephen Kennett</a>
</xen:if>

Can anyone advise how I can get this to display on different dates?

EG: 14th November, 21st November and the 28th November?

Any help appreciated
 
The code is similar:

<xen:if is="{xen:date $serverTime, 'd/m/y'} >= '14/11/12' AND {xen:date $serverTime, 'd/m/y'} < '21/11/12' AND {xen:date $serverTime, 'd/m/y'} == '28/11/12'">

EDIT:

You can actually combine the two if you're feeling adventurous.

There's a compiler function called datetime that accepts similar arguments.

So something like:

<xen:if is="{xen:datetime $serverTime, 'd/m/y, G:i'} >= '14/11/12, 17:00' AND {xen:datetime $serverTime, 'd/m/y, G:i'} < '21/11/12, 03:00' AND {xen:date $serverTime, 'd/m/y'} == '28/11/12'">

That would display whatever on the date 14th November after 5PM and before 3AM on the 21st November and all day on the 28th November.
 
Strictly speaking, I'm not sure how inequality works with two strings. 'string1' <= 'string2' may not work as you expect, but there are no other suitable functions available to the templates.
 

Similar threads

Back
Top Bottom