Skip to main content
Known Participant
November 2, 2007
Answered

Displaying a different web-page depending upon day.

  • November 2, 2007
  • 3 replies
  • 517 views
Hi all,

A total beginners question here as I'm unsure as to how to start this project.

I have a news page on my work web site and have been asked that every Friday the page displays a differnet page: A summary of the weeks news.... (I've only ever used cfm for database things so this is a new direction for me).

I am not sure where to start. I could get coldfusion to find the date and time, but how could I get it to display a different page depending upon what day it is?

Any guidance to get me pointed in the right direction would be appreciated.

Thanks,

Paul.
This topic has been closed for replies.
Correct answer Newsgroup_User
don't forget the dayofweek()/dayofweekasstring() functions, too!

if it is a proper html/cfm page with the week's summary that you have,
you can simply use <cflocation> to redirect from your original page to
the new one if today is Friday...

i.e, at the top of your original news page add:

<!--- by default the dayofweek() function returns day number from
1=Sunday to 7=Saturday, so Friday=6 --->

<cfif dayofweek(now()) is 6>
<cflocation url="yourpageurlhere" addtoken="no">
</cfif>

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

3 replies

Newsgroup_UserCorrect answer
Inspiring
November 3, 2007
don't forget the dayofweek()/dayofweekasstring() functions, too!

if it is a proper html/cfm page with the week's summary that you have,
you can simply use <cflocation> to redirect from your original page to
the new one if today is Friday...

i.e, at the top of your original news page add:

<!--- by default the dayofweek() function returns day number from
1=Sunday to 7=Saturday, so Friday=6 --->

<cfif dayofweek(now()) is 6>
<cflocation url="yourpageurlhere" addtoken="no">
</cfif>

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Paul13Author
Known Participant
November 5, 2007
Thanks for the reply a neat way to do things,

Paul.,

Paul13Author
Known Participant
November 2, 2007
Hi Dan,

I think that I'm getting there... I could use DatePart to identify the day then <cfif> & <cfelse> to decide whether to <cfinclude> my IT news page or the secretaries news summary page.

Thanks,

Paul.
Inspiring
November 2, 2007
The first thing to determine is where you expect to get the summary of the weeks news from.
Paul13Author
Known Participant
November 2, 2007
Hi Dan,

Basically I have an news page which we have set as the home-page on the browsers for folk within our Department at work that tells of any IT support news within the Department.

I have however been asked that would it be possible to display the Departments Bulletin of news each Friday (Which is published each Friday by the secretarial staff and is in a different location on the departments web-site).

I'm afraid that I only really dabble with Coldfusion and have not yet really developed the indepth skills so was just enquiring as to see if this sort of thing is possible and what sort of direction I should be looking. Most of the CFM projects that I have done so far have simply been inputing web-form information into databases and displying the results.


I would happily contribute to discussions if I felt that I could. With only 14 posts you can see that I am very much a beginner and only use Coldfusion occaisionally. But I've got to start somewhere, and I do contribute to other forums where I feel that I have the nessessary skills to answer folks questions.

Thanks,

Paul.
Inspiring
November 2, 2007
quote:

Originally posted by: Paul1
Hi Dan,

Basically I have an news page which we have set as the home-page on the browsers for folk within our Department at work that tells of any IT support news within the Department.

I have however been asked that would it be possible to display the Departments Bulletin of news each Friday (Which is published each Friday by the secretarial staff and is in a different location on the departments web-site).

Paul.

Can we assume that the secretarial staff will be preparing the summary as well? If so, perhaps you can get them to upload the file to your server. Then you can rename it and include it in your cold fusion page.

The cold fusion tags you want to read about are <cffile> and <cfinclude>. If you don't have a cfml reference manual, google the tag, complete with angle brackets, plus the number of whatever version of Cold Fusion you are running.