How can I 'include' a file different php depending on time? Work on a 'Happening Now' page for an event and the need to plan a different content to load as the day continues. Thank you!

Work on a 'Happening Now' page for an event and the need to plan a different content to load as the day continues. Thank you!

The event has class sessions all day (3 days). I would like the page happening now to show what classes are going on right now and what is coming up next. I was hoping just to separate configuration files and load them when necessary, but open to all suggestions.

PHP has a powerful set of date and time functions.

To do this is to create a DateTime object and then use conditional logic to include the files you want. A better way would be to keep the details in a database and use the time to retrieve and display the details you want.

A DateTime object using:

$now = new DateTime();

$hour = $now-> format ('G'); This gives you time to the 24 hour clock.

If ($hour == 13) {}

It is between 13:00 and 14:00

} else if ($hour == 14) {}

It is between 14:00 and 15:00

} ....

Tags: Dreamweaver

Similar Questions

Maybe you are looking for

  • HP stored passwords

    HP P7-1120 How can I stop the HP storage my password to a website log-in?

  • Blue screen during installation of Windows XP on my Touchsmart TX2

    Hey guys. l am trying to install Windows XP on my new HP Touchsmart TX2, but the startup configuration every time l, the Tx2 stops with a blue screen when loading drivers. l tried with several discs, even those created with nLite and understood the S

  • Acer aspire one d257 gel

    I have an acer aspire one d257 that a TI was freezing all the time made e erything I have updated, deleted chrome, virus run maleware run, nothing helped so I just finally reinstalled win 7 home. Theres nothing installed except slime disc to install

  • How do Ifind my password

    55imalive

  • Tap to choose what happens with this device.

    I pressed accidentally on open pictures (or something like that) opens automatically whenever I insert my cameras SD card.   But I don't want the pictures or any other program to run whenever I have install my card.How do I get back to let the little