Re: PHP Daily Schedule Rotation
Posted: Fri Sep 25, 2009 9:41 am
Code: Select all
$page = 'dirname/'.strtolower(date('l')).'.html';A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$page = 'dirname/'.strtolower(date('l')).'.html';Code: Select all
<?php
$date = date('l');
//Let's concatenating the day of the week and '.html' into one variable for ease of use
$page = 'schedule/'.strtolower(date('l')).'.html';
//This checks to see if the filename exists in the current directory.
//If it does, it pulls the page up. If not, it pulls up a default page.
if (file_exists($page)){
include($page);
} else {
include('default.html');
}
?>Code: Select all
var_dump(file_exixts($file));Hijackpf wrote:What's your file structure?
You can check the files exist withCode: Select all
var_dump(file_exixts($file));
Code: Select all
$file = $_SERVER['DOCUMENT_ROOT'].'/Schedules/'.strtolower(date('l')).'.html';