473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Date Redirect + SSI -- Need help

I am creating a time-based art web site that will show a different html
page depending on the client side local date. I also prefer that the top
page doesn't literally redirect to, say 7.htm for the 7th of May, but
accesses that page via a Server Side Include or JS function. The work
doesn't need a date stamp more complicated than "7.htm".

I only know enough about Javascript to be dangerous. I have tried to
bodge together what I could find online and on usenet without success.
If someone could give me a hand with this, I would be happy to credit
them on the site (whenever it goes live).

Thanks to all who get this far,
Ben
Jul 23 '05 #1
2 1344
Hi Ben,

End Around wrote:
I am creating a time-based art web site that will show a different html
page depending on the client side local date.
Why do you want to use the client's local date? Using the server's date
would be much easier when you want the client to invoke just a fixed URL
like "art.html".

In that case, you can use PHP or any other server-side language to
determine the date and to display the appropriate page.

Moreover, a server-side solution would be independent of the
JavaScript-ability of the client's browser.
I only know enough about Javascript to be dangerous.


If you really want to use the client date, try

var dat = new Date();
location.href = "path/to/you/html/"+dat.getDay()+".html";

That would call pages like "7.html" on the 7th of May. Another solution
would be

var dat = new Date();
location.href = "path/to/you/html/page.html?day="+dat.getDay();

which calls "page.html?day=7".

If you want to encode the client date to make the fact that the page is
date-driven somewhat less obvious, do some calculations on the date, eg.

var dat = new Date();
var day = dat.getDay()*35+17;
location.href = "path/to/you/html/"+dat.getDay()+".html";

On the server-side, you will have to revert this calculation by taking
the encoded day number, subtracting 17, and dividing by 35.

Regards,

-.Lutz.-
Jul 23 '05 #2
JRS: In article <3e************@news.dfncis.de>, dated Sun, 8 May 2005
12:54:37, seen in news:comp.lang.javascript, =?ISO-
8859-15?Q?Lutz_I=DFler?= <tr***@lutzissler.net> posted :
If you really want to use the client date, try

var dat = new Date();
location.href = "path/to/you/html/"+dat.getDay()+".html";

That would call pages like "7.html" on the 7th of May.
It would never call for 7.html. Please test code before posting.
Another solution
would be

var dat = new Date();
location.href = "path/to/you/html/page.html?day="+dat.getDay();

which calls "page.html?day=7".
It will never do that.
If you want to encode the client date to make the fact that the page is
date-driven somewhat less obvious, do some calculations on the date, eg.

var dat = new Date();
var day = dat.getDay()*35+17;
location.href = "path/to/you/html/"+dat.getDay()+".html";
You're not using var day.
On the server-side, you will have to revert this calculation by taking
the encoded day number, subtracting 17, and dividing by 35.


Not necessarily, if the possible values of day are correctly predicted
and the pages named accordingly.
D.getDate() -> 1..31
D.getDay() -> 0..6

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: .Net Sports | last post by:
In my csharp code behind file, I'm trying to perform a redirect if the date a user queries is a Wednesday: string rqs = Request.QueryString; string rqsday; rqsday =...
3
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The...
6
by: Peter Row | last post by:
Hi, I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest. This code calls a sub and I need to know if that sub did a response redirect or not. Specifically I need to know...
56
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
0
by: john12345 | last post by:
Hi, I need help with the script below, the if statments are fine they work perfect. what i am looking for is getting the files from the directory /raw/ with the restriction. for example, the...
7
by: shivasusan | last post by:
Hello Friend! I am new for ASP. Database is Microsoft Access. So pls help me..... My problem is --- 1. In login page, two text boxs. first textbox is username & second textbox is...
3
by: janetopps | last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im...
3
by: shawnmiller77 | last post by:
Need Help ASAP! History: Installed new SBS 2003 server on Monday. Migrated IIS, website and current Access database over to new server. I did not develop the website or Access database. Former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.