Events Listings

From: Date: Sun, 24 Jun 2001 01:14:33 +0000
Subject: Events Listings
Groups: php.general 
Request: Send a blank email to php-general+get-55002@lists.php.net to get a copy of this message
Hello, I have a script that does TV/Tour listings for artist, I need it to sort the list automatically so that it goes in date order but I have absolutely no idea. I have put together the script with little to no PHP skills so it look pretty horrific. If you could help me out with figuring out how to fix it, it would be muchly appreciated. The code is below Rick <?php if ($max_days == ""){ $max_days = 365; } $current_day = date( "z"); echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" bgcolor=\"#000000\">\n"; echo "<tr bgcolor=\"#E5E5E5\"><td colspan=\"6\" align=\"right\"><b>alanis guide</b></td></tr>\n"; echo "<tr bgcolor=\"#E5E5E5\">\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">date</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">time</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">where</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">what</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">days till</FONT></td>\n"; echo "</tr>\n"; //Create Function function create($listing, $max_days){ list ($month, $day, $year, $time,$channel,$show) = split('/', $listing); $year = "20$year"; if ($channel == "VH1"){ $url = "http://www.vh1.com"; } if ($channel == "MTV"){ $url = "http://www.mtv.com"; } if ($channel == "COM"){ $url = "http://www.comedycentral.com"; } if ($channel == "HBO"){ $url = "http://www.hbo.com"; } if ($channel == "HBOZ"){ $url = "http://www.hbo.com"; } if ($channel == "HBOS"){ $url = "http://www.hbo.com"; } if ($channel == "TRIO"){ $url = "http://www.triotv.com"; } $current_day = date( "z"); $show_day = date( "z", mktime( 0, 0, 0, $month, $day, $year ) ); $time_till_event = $show_day - $current_day; if ($time_till_event < $max_days){ if ($time_till_event == '0'){ $time_till_event = "Today"; } if ($time_till_event == '1'){ $time_till_event = "Tomorrow"; } if ($time_till_event < 0){ return; } if ($url != ''){ $start = "<a href=\"$url\">"; $end = "</a>"; } if ($confirmed == 'yes'){ $image = "images/yes.gif"; } if ($confirmed == 'no'){ $image = "images/no.gif"; } echo "<tr bgcolor=\"#E5E5E5\">\n"; echo "<td><font face=\"Arial\" size=\"1\">$start$month.$day.$year$end</FONT></td>\n"; echo "<td><font face=\"Arial\" size=\"1\">$start$time$end</FONT></td>\n"; echo "<td><font face=\"Arial\" size=\"1\">$start$channel$end</FONT></td>\n"; echo "<td><font face=\"Arial\" size=\"1\">$start$show$end</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\">$start$time_till_event$end</FONT></td>\n"; echo "</tr>\n"; } else{ return; } } //Dates $listing = "06/24/01/04:00 pm/VH1/Saturday Night Live 25: The Music"; create($listing, $max_days); $listing = "06/24/01/05:00 pm/VH1/Before They Were Rock Stars"; create($listing, $max_days); $listing = "06/24/01/11:00 pm/HBOZ/Reverb"; create($listing, $max_days); $listing = "06/28/01/01:00 am/HBOZ/Reverb"; create($listing, $max_days); $listing = "06/28/01/11:00 am/VH1/VH1: All Access"; create($listing, $max_days); $listing = "06/28/01/10:00 pm/VH1/VH1: All Access"; create($listing, $max_days); $listing = "06/28/01/11:30 pm/VH1/VH1: All Access"; create($listing, $max_days); $listing = "06/29/01/09:30 pm/HBOS/Sex And The City"; create($listing, $max_days); $listing = "06/30/01/07:00 pm/VH1/VH1: All Access"; create($listing, $max_days); $listing = "07/01/01/01:00 am/TRIO/Paris Concert for Amnesty International"; create($listing, $max_days); $listing = "07/09/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks"; create($listing, $max_days); $listing = "07/09/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks"; create($listing, $max_days); $listing = "07/13/01/12:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop Songs "; create($listing, $max_days); $listing = "07/13/01/08:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop Songs "; create($listing, $max_days); $listing = "07/27/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks"; create($listing, $max_days); $listing = "07/27/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks"; create($listing, $max_days); $listing = "07/01/01//Ottawa, ON/Canada Day"; create($listing, $max_days); $listing = "07/03/01//Kristiansand, NOR/Quart Festival "; create($listing, $max_days); $listing = "07/05/01//Stockholm, SWE/Annex "; create($listing, $max_days); $listing = "07/06/01//Sundsvall, SWE/City Festival "; create($listing, $max_days); $listing = "07/07/01//Odense, DEN/Midtfyns Festival "; create($listing, $max_days); $listing = "07/09/01//Hamburg, GER/Stadtpark "; create($listing, $max_days); $listing = "07/11/01//Montreux, SWI/Montreux Jazz Festival "; create($listing, $max_days); $listing = "07/12/01//Brescia, ITA/Piazza Duomo "; create($listing, $max_days); $listing = "07/13/01//Palermo, ITA/To Be Announced "; create($listing, $max_days); $listing = "07/28/01//Nigata, JPN/Fuji Rock Festival "; create($listing, $max_days); $listing = "07/31/01//Anchorage, AK/Egan Civic & Conv. Ctr. "; create($listing, $max_days); echo "<tr align=\"center\" bgcolor=\"#E5E5E5\"><td colspan=\"6\"><font size=\"-2\">All shows are Eastern Standard Time unless otherwise noted</font></td></tr>\n"; echo "</table>\n"; ?>

« previous php.general (#55002) next »