HTML dated pages
Discussion
I'm writing a very basic set of 'home-pages' and want to know if there's any way I can write a page but not have it appear until a certain date, or even better, date and time. I want to be able to put the page on my server and leave it there, and then when the date/time is reached, the page to be made visible to the 'net.
Is this possible in a simple way? or do I need some complex system?
Is this possible in a simple way? or do I need some complex system?
Thanks, but I'm not totally sure if that is what I'm after. I've had a very brief look at both of their home pages and I wouldn't know where to start. Let me explain my scenario. I'm writing a very simple website to publicise my forthcoming wedding, so that Family, Friedns etc can get extra details (Maps etc) online. Our Honeymoon is a surprise (only the travel agent and I know where) so I want to write a 'spoof' honeymoon page and then have the real honeymoon page appear after we've let for it.
My webpages are hosted on my ISP space, I don't want to (or can't) leave my PC running connected to the ISP, so I need to have a way of making the right page appear at the right time.
I don't want to leave it for a person, as I'd have to give them my username/password etc to be able to upload the pages. Plus I don't think any of my family are technically mided enough to have a clue!!
Any ideas?
My webpages are hosted on my ISP space, I don't want to (or can't) leave my PC running connected to the ISP, so I need to have a way of making the right page appear at the right time.
I don't want to leave it for a person, as I'd have to give them my username/password etc to be able to upload the pages. Plus I don't think any of my family are technically mided enough to have a clue!!
Any ideas?
you could use a bit of javascript to detect the day of the month and redirect to the relevant page. Something like this might do.
[html]
[head]
[script language="JavaScript"]
[!--
var today = new Date();
var dayofmonth = today.getDate();
window.location = dayofmonth + ".html";
// --]
[/script]
[/head]
[body][/body]
[/html]
*you will need to change the square brackets
[html]
[head]
[script language="JavaScript"]
[!--
var today = new Date();
var dayofmonth = today.getDate();
window.location = dayofmonth + ".html";
// --]
[/script]
[/head]
[body][/body]
[/html]
*you will need to change the square brackets
wildeep said:
you could use a bit of javascript to detect the day of the month and redirect to the relevant page. Something like this might do.
[html]
[head]
[script language="JavaScript"]
[!--
var today = new Date();
var dayofmonth = today.getDate();
window.location = dayofmonth + ".html";
// --]
[/script]
[/head]
[body][/body]
[/html]
*you will need to change the square brackets
Except that the javascript is client side so the url for the page you want to remain a secret would be viewable.
a simple server side asp response.redirect or the php version of the same based on the date would be perfect.
Thanks for the code, but where (or how) do I put my requested date in. Do I put this code in the page that is visible before, or the page that is visible after. Also, where do I put the re-direct address? Sorry, but I'm not very hot on code or anything more advanced than "10 print hello, 20 goto 10"
wildeep said:
you could use a bit of javascript to detect the day of the month and redirect to the relevant page. Something like this might do.
[html]
[head]
[script language="JavaScript"]
[!--
var today = new Date();
var dayofmonth = today.getDate();
window.location = dayofmonth + ".html";
// --]
[/script]
[/head]
[body][/body]
[/html]
*you will need to change the square brackets
Ok, if you dont want to do it client side then there is a another way. create a page called index.php or you can call it index.html if your server will parse HTML pages for php code and insert the following code in it, making sure to replace the first and last square brackets with angle brackets.
[?php
$day = date('j');
if($day <= 6) // insert before date here
header("Location: www.yourdomainname.co.uk/beforethe6th.html" ); // fake honeymoon page URL
else if($day > 6) //insert after date here
header("Location: www.yourdomainname.co.uk/afterthe6th.html" ); // real honeymoon page URL
?]
then just enter the date you want the page to change, in my example i have used the 6th, and the URLs of both the real and fake honeymoon pages. If your honeymoon is going to go over to another month then the page will change back but then we can add an extra few lines to detect the month as well.
>> Edited by wildeep on Monday 27th February 09:13
[?php
$day = date('j');
if($day <= 6) // insert before date here
header("Location: www.yourdomainname.co.uk/beforethe6th.html" ); // fake honeymoon page URL
else if($day > 6) //insert after date here
header("Location: www.yourdomainname.co.uk/afterthe6th.html" ); // real honeymoon page URL
?]
then just enter the date you want the page to change, in my example i have used the 6th, and the URLs of both the real and fake honeymoon pages. If your honeymoon is going to go over to another month then the page will change back but then we can add an extra few lines to detect the month as well.
>> Edited by wildeep on Monday 27th February 09:13
Just out of curiosity....do you have PHP installed?
If so it's very very simple!
You actually write both pages to the same file but one bit shows on one date and then the other part after your specified date.
Example:
If so it's very very simple!
You actually write both pages to the same file but one bit shows on one date and then the other part after your specified date.
Example:
Beanbags PHP example said:
<?php
$current_date = date("dmY"
$show_page_date = "10052006"; // Enter here the date you want your page to show
if ($current_date < $show_page_date)
{
?>
<!-- Begin Spoof Website Page -->
<HTML>
<HEAD>
<TITLE>SPOOF WEBSITE</TITLE>
</HEAD>
<BODY>
Stuff in Spoof Website
</BODY>
</HTML>
<!-- End Spoof Website Page -->
<?php
}
else
{
?>
<!-- Begin Real Website Page -->
<HTML>
<HEAD>
<TITLE>REAL WEBSITE</TITLE>
</HEAD>
<BODY>
Stuff in Real Website
</BODY>
</HTML>
<!-- End Website Page -->
<?php>
}
?>
wildeep said:
Ok, if you dont want to do it client side then there is a another way. create a page called index.php or you can call it index.html if your server will parse HTML pages for php code and insert the following code in it, making sure to replace the first and last square brackets with angle brackets.
[?php
$day = date('j');
if($day <= 6) // insert before date here
header("Location: www.yourdomainname.co.uk/beforethe6th.html" ); // fake honeymoon page URL
else if($day > 6) //insert after date here
header("Location: www.yourdomainname.co.uk/afterthe6th.html" ); // real honeymoon page URL
?]
then just enter the date you want the page to change, in my example i have used the 6th, and the URLs of both the real and fake honeymoon pages. If your honeymoon is going to go over to another month then the page will change back but then we can add an extra few lines to detect the month as well.
>> Edited by wildeep on Monday 27th February 09:13
Damn! Same thing really and you beat me!! grrr!

Beanbag, I've just checked my ISP and it says I can use PHP, now I just have to play around and see if it can read PHP from within HTML or if I need to write a PHP file. I'll have a play tonight and see how I get on.
Very many thanks for all of your help. Guess I now need to write a test page and see how I get on.
Cheers guys!!
Very many thanks for all of your help. Guess I now need to write a test page and see how I get on.
Cheers guys!!
philip_cooke said:
Beanbag, I've just checked my ISP and it says I can use PHP, now I just have to play around and see if it can read PHP from within HTML or if I need to write a PHP file. I'll have a play tonight and see how I get on.
Very many thanks for all of your help. Guess I now need to write a test page and see how I get on.
Cheers guys!!
No probs! If you need any help, email me and i'll have a look at your code.

Well, Having said that my ISP uses CGI, I now find that it's NOT one of the options I can use on my account. Is there any way I can use something else to do this date thing? Wildeep gave some javascript but I don't know how to apply it. If anyone can show me where to put the date etc, I'd be very grateful.
Cheers in advance,
Cheers in advance,
wildeep said:
[html]
[head]
[script language="JavaScript"]
[!--
var today = new Date();
var dayofmonth = today.getDate();
if(dayofmonth > 27) (window.location = "realhoneymoon.htm";
// --]
[/script]
[/head]
[body]FAKE HONEYMOON PAGE DETAILS[/body]
[/html]
*you will need to change the square brackets
Well, I've now managed to get this to work (slightly modified) but it opens up the link into a new window. How can I keep it in the same window without another being opened? Also, I've tried to add the monthofyear into the script but can't get it to work. Can you show me how to add it in please?
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff




your way looks a bit simpler to mine