How do you get php date based text display?
August 16, 2008 4:27 PM   Subscribe

I need a php script that displays, as an include, an .html file depending on the day of the week.

This seems very simple and I have scoured the internet but can't quite find what I'm looking for. It seems easy to me, but I lack above-basic knowledge of php.

Here's what I want: I will make seven .html files, named monday.html, tuesday.html, etc, and throw them in a folder. I want the script to grab the file depending on what day of the week it is and display it on a sidebar. Does it get simpler than this? I can't figure it out! Please help, thanks.
posted by hammerthyme to Computers & Internet (2 answers total) 4 users marked this as a favorite
 
Best answer: <?php
$path = '/path/to/my/directory';
$day = strtolower(date('l'));
include("$path/$day.html");
?>
posted by staggernation at 4:39 PM on August 16, 2008


Response by poster: Thanks! I wasn't using the full server path.
posted by hammerthyme at 4:44 PM on August 16, 2008


« Older Mongol Nazis?!   |   Either way, it's disturbing... Newer »
This thread is closed to new comments.