Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change a page according to date

Status
Not open for further replies.

janinja

Technical User
Nov 28, 2000
18
NZ
Does anyone know how I can automatically change a page according to the date? In my case, I need to do it for a daily horoscope page over the christmas period when I can't come into work. I was thinking along the lines of using something like CF schedule but I'm not too sure so if anyone has any ideas I will be v.grateful.

janinja : )
 
maybe just a <cfif> or <cfcase> is fine enough
depends on what exactly you want to change
 
I don't want to keep one page and change the content according to the date, I want to actually make a different page load according to the date : ( can't work out how to do it!
 
ok, you want to display this page or that page according to the date right ? you have 31 page, one for every day ??
the answer is the same as above, use a cfswitch
<cfswitch expression=&quot;the_day&quot;>
<cfcase value=&quot;monday&quot;>
<cflocation=&quot;the_monday_file.cfm&quot;>
</cfcase>
....

and so on
 
I would recommend an option to Iza's solution. Instead of using the cflocation, you could do a cfinclude as in <cfinclude template=&quot;HomePage_#dateformat(now(),&quot;dd&quot;)#.cfm&quot;> The reason I point this out is that a cflocation actually sends back a redirect response to the browser which then has to request the new page. This causes a slight delay and makes the browser issue two requests to get the original page. There is nothing wrong with using cflocation but IMO, cfincludes where possible make things a little more efficient.

GJ
 
you're right gunjack ! i was focusing on the syntax and forgot the efficiency of the solution ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top