Re: RE: Events Listings

From: Date: Wed, 27 Jun 2001 08:07:23 +0000
Subject: Re: RE: Events Listings
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55334@lists.php.net to get a copy of this message
> A.) Do it for me :-) Okay, but you have to go listen to http://ellenrosner.com/ Not as whiny as Alanis, but you might like it :-) > <?php # Create an array to hold all the shows: $shows = array(); > 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"; > } > /* Comment out all this, so create() doesn't do any actual output. See below: > 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"; */ # Use the $shows variable that lives outside this function: global $shows; # Throw the date and the table row in it: # Muck with your time/date to get Unix time-stamp: if ($time){ $time_parts = explode(' ', $time); $hourmin = $time_parts[0]; $ampm = $time_parts[1]; $time_parts2 = explode(':', $hourmin); $hour = $time_parts2[0]; $min = $time_parts2[1]; $unixdate = mktime($hour, $min, 0, $month, $day, $year); } else{ $unixdate = mktime(0, 0, 0, $month, $day, $year); } # Add this event to the array with the Unix time stamp as the key: $shows[$unixdate] = "<tr bgcolor=e5e5e5><td><font face=Arial size=1>$start$month.$day.$year</td><td><font face=Arial size=1>$start$time$end</td><td><font face=Arial>$start$channel$end</td><td><font face=Arial size=1>$start$show$end</td><td align=center><font face=Arial size=1>$start$time_till_event$end</td></tr>"; > } > 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); # So now we have this array we can sort: ksort($shows); # And now we can spew them out in order: reset($shows); while (list($unixdate, $table_row) = each($shows)){ echo $table_row; } > 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"; > ?> -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#55334) next »