Re: [PHP] Events Listings

2001-06-24 Thread Chris Hayes


From:   	"Rick Proctor" <[EMAIL PROTECTED]>

> 
> 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.

>$listing = "06/24/01/04:00 pm/VH1/Saturday Night Live 25: The Music";
>create($listing, $max_days);


Hi Rick,

Holy smoke, nice code but i would like to tell you about some other ways to  handle data.


If you have access to an online database like MySQL (or whatever) you can  make one page to enter events into a MySQL database table and then in  another page show the events. This will have a data query which sorts the  items by date. You can even sort with subsections like by artist fisst and  then by date.

If you don't have access to an online database i would say: make a seperate  file with the data. 
In your codepage: 
* read that file line by line and put it in an event-array.
* sort the event-array by date.
* reset the event-array so the index is at the first item (reset  ($event_array))
* now go through the array using the while function.


An advanced programmer could make a page in which you could edit that data  file through php.

The way the file should look? 
Depends. I suggest to use the CSV file ormat as there are free PHP code  classes around to help you handle the file and data in it.
A line might look like:
'010624',04:00,'pm','VH1','Saturday Night Live 25: The Music'

(as you see i would put the comlete date in the first field with the YYMMDD  format to ease sorting, however you would need to adapt your whole script  then...)

Tips to make the production of that event data file easy:

Excel tip: If you enter you stuff in an Excel sheet you can sort it before  exporting it as a CSV file. 
Excel tip 2: make a worksheet with the top row as labels. Then try menu:data  item: form. Voila, a simple data entry form!


Excel tip 3: I have a nice VBA script to ease data entry in Excel. It shows  you a nice data entry form. You can even export the data into some  customizable template, ordered! Mail me if you are interested. 
?>

 Chris
* i do not read my email every day *



--  C.Hayes  Droevendaal 35  6708 PB Wageningen  the Netherlands  --


 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



[PHP] Events Listings

2001-06-23 Thread Rick Proctor

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

\n";
echo "alanis
guide\n";
echo "\n";
echo "date\n";
echo "time\n";
echo "where\n";
echo "what\n";
echo "days till\n";
echo "\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 = "";
$end = "";
}
if ($confirmed == 'yes'){
$image = "images/yes.gif";
}
if ($confirmed == 'no'){
$image = "images/no.gif";
}

echo "\n";
echo "$start$month.$day.$year$end\n";
echo "$start$time$end\n";
echo "$start$channel$end\n";
echo "$start$show$end\n";
echo "$start$time_till_event$end\n";
echo "\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 "All shows are Eastern Standard Time unless otherwise
noted\n";
echo "\n";
?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]