Hi
In Coldfusion can you restrict the display of a certain image for only
certain times of the day?
For example only display the image before 8pm 12pm-2pm and after 5pm on
the site homepage
If so any ideas on the best way to achieve this?
TIA
Wrap it up in a CFIF or CFCASE statement.
cfset currentHour = timeformat(now(),'hh')
cfif currentHour gte '08' and currentHour lt '12'
cfset imagetoDisplay = 'morning.png'
cfelseif currentHour gte 12 and currentHour lt 5
cfset imagetoDisplay = 'afternoon.png'
cfelse
cfset
If so any ideas on the best way to achieve this?
Simply use CFIF tag and now() function.
You'll be able to generate or not any code whenever you need.
~|
Want to reach the ColdFusion community with something they want? Let
!--- get the time in whole number, 24-hour (military time) ---
cfset timeTest = val(timeFormat(now(), HHmm)) /
!--- run the tests ---
cfif (timeTest lt 800) or (timeTest gte 1200 and timeTest lt 1400) or
(timeTest gt 1700)
img src=imageToShow.jpg /
/cfif
Thanks all for the prompt responses.
Both solutions work great!
Thanks again
-Original Message-
From: Jason Fisher [mailto:ja...@wanax.com]
Sent: 16 June 2009 14:24
To: cf-talk
Subject: re: Limiting the display of an image to certain times of the
day with CF?
!--- get the time in
5 matches
Mail list logo