cargogirl Posted November 27, 2009 Share Posted November 27, 2009 hi I don't know any php (only html) and I urgently need to do the following: I need an iframe that calls up a different page according to the date e.g. on the 2th Dec a page called 'special2.php', then on the 3rd Dec a page is called up 'special3.php' can anyone help. I have done numerous searches but have come up with no answers Link to comment https://forums.phpfreaks.com/topic/183094-i-need-an-iframe-that-calls-up-a-different-page-according-to-the-date/ Share on other sites More sharing options...
abazoskib Posted November 27, 2009 Share Posted November 27, 2009 To address your question, <?php $day = date("d"); ?> <iframe src="special<?php echo $day; ?>.php"></iframe> I have a feeling that unless you are doing something completely different on each page, that you could easily combine all your "special" files into one file. Why exactly do you have a file for each day of the month? Link to comment https://forums.phpfreaks.com/topic/183094-i-need-an-iframe-that-calls-up-a-different-page-according-to-the-date/#findComment-966306 Share on other sites More sharing options...
cargogirl Posted November 27, 2009 Author Share Posted November 27, 2009 thanks for you prompt reply. we are having a sale where the product discounts everyday and we are using paypal order buttons for purchase which means that the paypal button has to be coded with the price. So I though making a page for each day with the correct prices coded on the paypal button. I don' t understand how the php calls up the file, meaning how does it know which file to calll up on which date? Link to comment https://forums.phpfreaks.com/topic/183094-i-need-an-iframe-that-calls-up-a-different-page-according-to-the-date/#findComment-966308 Share on other sites More sharing options...
abazoskib Posted November 27, 2009 Share Posted November 27, 2009 date("d") will get the number of the current day of the month. I am just putting together your base file name with whatever day of the month it is. Link to comment https://forums.phpfreaks.com/topic/183094-i-need-an-iframe-that-calls-up-a-different-page-according-to-the-date/#findComment-966314 Share on other sites More sharing options...
cargogirl Posted November 27, 2009 Author Share Posted November 27, 2009 do you mean if the file is named 'specials27.php' it will call up the file on the 27th. does the date come from the users computer or the server. I did try to test this and the same file kept loading after I changed the date on my computer sorry for being such a dummy Link to comment https://forums.phpfreaks.com/topic/183094-i-need-an-iframe-that-calls-up-a-different-page-according-to-the-date/#findComment-966319 Share on other sites More sharing options...
abazoskib Posted November 27, 2009 Share Posted November 27, 2009 PHP is a server side language, so the time is coming off of the server. No user input needed. Did you try the code? It should work exactly the way you want it to. Check out the php manual for more date() information. Link to comment https://forums.phpfreaks.com/topic/183094-i-need-an-iframe-that-calls-up-a-different-page-according-to-the-date/#findComment-966439 Share on other sites More sharing options...
cargogirl Posted November 28, 2009 Author Share Posted November 28, 2009 yes, it works perfectly. thank you for your help, much appreciated Link to comment https://forums.phpfreaks.com/topic/183094-i-need-an-iframe-that-calls-up-a-different-page-according-to-the-date/#findComment-966754 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.