Jump to content


Photo

Help on how to include a page based on the date??


  • Please log in to reply
2 replies to this topic

#1 lonsalot

lonsalot
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 14 August 2006 - 05:43 AM

Can anybody show me how to include a page based on the date.  I would like to have a different page depended on what day of the year it is.  So the code should include Leap Years too.  Has anybody seen this done before with PHP.  I can't imagine that it's that hard.  I just am not familar that much with PHP.  If there is a link to a tutorial that is similar to this, could you let me know.

Thanks,
Lonsalot

#2 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 14 August 2006 - 06:18 AM

Example:
<?php
$date = date("d.m.Y"); // dd.mm.yyyy
$date1 = explode(".", $date);
/*echo
$date1[0] // dd
$date1[1] // mm
$date1[2] // yyyy
*/
if ($date1[0] == "14" && $date1[1] == "08" && $date1[2] == "2006")
{
	echo "There";
}
?>


Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#3 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 14 August 2006 - 06:20 AM

include date('Md') . '.php';

This will include "Aug14.php" today
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users