Jump to content

Recommended Posts

Hey guys :)

 

I am currently doing a project for a client (can't go into to much detail than that)

 

He wants me to create a schedule of his upcoming shows. Each show will go away on the next day after the show, and the next schedule will role up and be bold.

 

So here is what I have:

 

<?php

$satShowHours = " - 06:00AM, 06:26AM";
$sunShowHours = " - 08:00AM, 08:26AM";

// These are the dates
$schedule = array
(
"sched1"=>"Sat Jul 26, 2008",
"sched2"=>"Sun Jul 27, 2008",
"sched3"=>"Thu Aug 02, 2008",
"sched4"=>"Thu Aug 03, 2008",
"sched5"=>"Thu Aug 09, 2008",
"sched6"=>"Thu Aug 10, 2008",
"sched7"=>"Thu Aug 16, 2008",
"sched8"=>"Thu Aug 17, 2008",
"sched9"=>"Thu Aug 23, 2008",
"sched10"=>"Thu Aug 24, 2008",
"sched11"=>"Thu Aug 30, 2008",
"sched12"=>"Thu Aug 31, 2008",
"sched13"=>"Thu Sep 06, 2008",
"sched14"=>"Thu Sep 07, 2008",
"sched15"=>"Thu Sep 13, 2008",
"sched16"=>"Thu Sep 14, 2008",
"sched17"=>"Thu Sep 20, 2008",
"sched18"=>"Thu Sep 21, 2008",
);


//DO NOT EDIT BELOW THIS LINE
if (
    strtotime("now") > strtotime("26 July 2008")
)
    echo "";
else
    echo $schedule['sched1'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("27 July 2008")
)
    echo "";
else
    echo $schedule['sched2'] . $sunShowHours;
    
echo "</br>";

if (
    strtotime("now") > strtotime("02 August 2008")
)
    echo "";
else
    echo $schedule['sched3'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("03 August 2008")
)
    echo "";
else
    echo $schedule['sched4'] . $sunShowHours;
    
echo "</br>";

if (
    strtotime("now") > strtotime("09 August 2008")
)
    echo "";
else
    echo $schedule['sched5'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("10 August 2008")
)
    echo "";
else
    echo $schedule['sched6'] . $sunShowHours;
    
echo "</br>";

if (
    strtotime("now") > strtotime("16 August 2008")
)
    echo "";
else
    echo $schedule['sched7'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("17 August 2008")
)
    echo "";
else
    echo $schedule['sched8'] . $sunShowHours;

echo "</br>";

if (
    strtotime("now") > strtotime("23 August 2008")
)
    echo "";
else
    echo $schedule['sched9'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("24 August 2008")
)
    echo "";
else
    echo $schedule['sched10'] . $sunShowHours;
    
echo "</br>";

if (
    strtotime("now") > strtotime("30 August 2008")
)
    echo "";
else
    echo $schedule['sched11'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("31 August 2008")
)
    echo "";
else
    echo $schedule['sched12'] . $sunShowHours;
    
echo "</br>";

if (
    strtotime("now") > strtotime("06 September 2008")
)
    echo "";
else
    echo $schedule['sched13'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("07 September 2008")
)
    echo "";
else
    echo $schedule['sched14'] . $sunShowHours;
    
echo "</br>";

if (
    strtotime("now") > strtotime("13 September 2008")
)
    echo "";
else
    echo $schedule['sched15'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("14 September 2008")
)
    echo "";
else
    echo $schedule['sched16'] . $sunShowHours;
    
echo "</br>";

if (
    strtotime("now") > strtotime("20 September 2008")
)
    echo "";
else
    echo $schedule['sched17'] . $satShowHours;
    
echo "</br>";
    
if (
    strtotime("now") > strtotime("21 September 2008")
)
    echo "";
else
    echo $schedule['sched18'] . $sunShowHours;

?>

 

I am sure there is a better way to do this, but I have no idea what?

 

Here is my problem. When I load this it ignore the "</br>". And, I have no idea how to tell the first one to be bold, and then when it leaves, then next one is bold etc etc. I am not sure if I calculated the time right either. The other thing is that instead of disappearing and letting the next date role up, it adds a "<br>"... aarggg. Maybe I need to get some sleep..lol

 

Your help is greatly appreciated :)

Danmaxito

 

Link to comment
https://forums.phpfreaks.com/topic/116824-php-schedule/
Share on other sites

<?php

$satShowHours = " - 06:00AM, 06:26AM";

$sunShowHours = " - 08:00AM, 08:26AM";

 

$startdate = strtotime("2008-07-26");

$enddate = strtotime("2008-09-21");

 

for($i=$startdate; $i <= $enddate; $i = $i + 86400){

    if(date("w", $i) == "0") {

            echo date("D M d, Y,", $i)." ".$sunShowHours;

    }

    if(date("w", $i) == "1") {

            echo date("D M d, Y,", $i)." ".$satShowHours;

    }

 

}

 

 

?>

 

something like this ??

PS: code is nt tested.

Link to comment
https://forums.phpfreaks.com/topic/116824-php-schedule/#findComment-600736
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.