PHP Daily Schedule Rotation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: PHP Daily Schedule Rotation

Post by jackpf »

Code: Select all

$page = 'dirname/'.strtolower(date('l')).'.html';
maybe?
User avatar
CONFUSIONUK
Forum Newbie
Posts: 17
Joined: Thu Sep 24, 2009 5:15 pm
Location: Winchester, UK

Re: PHP Daily Schedule Rotation

Post by CONFUSIONUK »

Will try this and get back to you asap :wink:
User avatar
CONFUSIONUK
Forum Newbie
Posts: 17
Joined: Thu Sep 24, 2009 5:15 pm
Location: Winchester, UK

Re: PHP Daily Schedule Rotation

Post by CONFUSIONUK »

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');
}
?>
http://www.shedbass.net/confusion/sb2/
http://www.shedbass.net/confusion/sb2/schedule/

have a look over that, we are completely puzzled :?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: PHP Daily Schedule Rotation

Post by jackpf »

What's your file structure?

You can check the files exist with

Code: Select all

var_dump(file_exixts($file));
User avatar
JePS
Forum Newbie
Posts: 4
Joined: Fri Sep 25, 2009 1:17 pm

Re: PHP Daily Schedule Rotation

Post by JePS »

jackpf wrote:What's your file structure?

You can check the files exist with

Code: Select all

var_dump(file_exixts($file));
Hi

I'm working with Confusion on this project - Basically we have a file called Schedule.php - This file contains the lump of code that calls the daily html files up and is located in the public_html folder. Coming off that folder we have a directory called /Schedule/ which contains all the daily html files.

We would like to edit the php script to call from the /schedule/ folder instead of the folder that houses schedule.php


Any ideas?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: PHP Daily Schedule Rotation

Post by jackpf »

*nix has case sensitive directory/file names. Try using the correct case ;)

If that doesn't work, try something like this:

Code: Select all

$file = $_SERVER['DOCUMENT_ROOT'].'/Schedules/'.strtolower(date('l')).'.html';
Post Reply