Limiting the display of an image to certain times of the day with CF?

2009-06-16 Thread Ian Vaughan

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


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323526
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Limiting the display of an image to certain times of the day with CF?

2009-06-16 Thread Rob Parkhill

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 imagetoDisplay = 'restoftheday.png'
/cfif

img src='images/#imagetoDisplay#' border=0

That should do it.

HTH

Rob

On Tue, Jun 16, 2009 at 9:10 AM, Ian Vaughan 
i.vaug...@neath-porttalbot.gov.uk wrote:


 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


 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323527
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Limiting the display of an image to certain times of the day with CF?

2009-06-16 Thread Claude Schneegans

 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 them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323528
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


re: Limiting the display of an image to certain times of the day with CF?

2009-06-16 Thread Jason Fisher

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


From: Ian Vaughan i.vaug...@neath-porttalbot.gov.uk
Sent: Tuesday, June 16, 2009 9:12 AM
To: cf-talk cf-talk@houseoffusion.com
Subject: Limiting the display of an image to certain times of the day with 
CF? 

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



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323529
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Limiting the display of an image to certain times of the day with CF?

2009-06-16 Thread Ian Vaughan

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


From: Ian Vaughan i.vaug...@neath-porttalbot.gov.uk
Sent: Tuesday, June 16, 2009 9:12 AM
To: cf-talk cf-talk@houseoffusion.com
Subject: Limiting the display of an image to certain times of the day
with 
CF? 

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





~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323530
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4