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.
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.
Response by poster: Thanks! I wasn't using the full server path.
posted by hammerthyme at 4:44 PM on August 16, 2008
posted by hammerthyme at 4:44 PM on August 16, 2008
This thread is closed to new comments.
$path = '/path/to/my/directory';
$day = strtolower(date('l'));
include("$path/$day.html");
?>
posted by staggernation at 4:39 PM on August 16, 2008