Click to See Complete Forum and Search --> : Creating a Schedule?
tobyw_1969
03-08-2004, 06:26 AM
I have a schedule of performances on a website I built - you can see it here...
Performance Schedule (http://www.ciaofestival.org.uk/schedule-thurs.htm)
At the moment this is all done manually using a table, and it's pretty messy and very time consuming to update.
I have been trying to think of a way to create a nice table like this but using XML or PHP, but I have to admit I'm a bit stumped. I want each performance block to sit over the relevant times - so if the performance lasts from 10-11.30 for example.
I'm sure there must be a simple way to make a nice schedule which is created automatically from XML - does anyone know how?
Thanks a lot
Toby
crh3675
03-08-2004, 08:29 AM
Start with something like this:
<?xml version="1.0" encoding="UTF-8"?>
<schedule>
<network name="Wilde Theatre">
<program>
<title>The Firbird</title>
<description>blah blah blah blah</description>
<performances>
<performs>
<date>2004-03-13</date>
<start>9:45</start>
<end>10:45</end>
</performs>
<performs>
<date>2004-03-13</date>
<start>1:45</start>
<end>2:45</end>
</performs>
</performances>
</program>
</network>
<network name="Bracknell Gallery">
<program>
<title>Dream Diaries</title>
<description>blah blah blah blah</description>
<performances>
<performs>
<date>2004-03-13</date>
<start>11:00</start>
<end>12:00</end>
</performs>
<performs>
<date>2004-03-13</date>
<start>12:30</start>
<end>1:30</end>
</performs>
</performances>
</program>
</network>
</schedule>
tobyw_1969
03-08-2004, 09:28 AM
Thanks Craig...but how could I then use PHP or a CSS to lay it out into a table like on the example?
crh3675
03-08-2004, 10:01 AM
You would want to create an XSL file and transform it using an XSLT processor such as Sablotron or Xalan. The problem you are going to encounter is the calculation of "rowspan" for each individual entry based on the time of each show.
tobyw_1969
03-08-2004, 10:16 AM
Well yeah..that's kind of the problem I was asking about. Does anyone actually know a way to do this?
Khalid Ali
03-08-2004, 04:56 PM
use a server side language such as php or jsp and then parse your XML.
One done doing that , create the table structure synamically usign php or jsp
tobyw_1969
03-08-2004, 07:10 PM
So I ask 'how can I use XML and PHP to create a table dynamically'? And you guys have so far managed to reply 'Use XML, and create the table dynamically using PHP'. Thanks....really helpful. Please, if you can't actually HELP don't bother posting.
Is there anyone out there who could actually ANSWER this question, ie. actualy suggest some PHP code on how you would create the table?
Sorry to sound ungrateful, but honestly, just repeating what I've asked is not exactly helpful.
Khalid Ali
03-08-2004, 09:52 PM
Originally posted by tobyw_1969
Sorry to sound ungrateful, but honestly, just repeating what I've asked is not exactly helpful.
You can not expect some one to write complete code for you.People here are volunteers just like you....if you need to lean how php creates tables php.net have allots of resources.
tobyw_1969
03-09-2004, 07:04 AM
Toby said:
I have been trying to think of a way to create a nice table like this but using XML or PHP
Khalid said:
use a server side language such as php or jsp
Khalid - I don't EXPECT anyone to help, but I do expect people who CAN'T help to keep quiet so that those who actually know what they are talking about don't see all the replies and think the question has been answered.
As for posting code, no I don't expect anyone to write an entire script, but just saying 'use PHP' in a PHP forum is pretty unhelpful and just clogs up the thread. If you don't know, don't post.
Finally, if you go to
Flash MX Files (http://www.flashmxfiles.com/phpBB2/index.php)
and look fro some of the replies I give to people voluntarily, you will see that I am often prepared to go out of my way to help them with code snippets and detailed explanations. That's why I didn't think it was unreasonable to hope someone might supply a slightly more helpful answer than 'use PHP'.
In future, if you don't know the answer to something, and you can't be bothered to read the actual question, please don't post an unhelpful answer.
crh3675
03-09-2004, 08:39 AM
Originally posted by Khalid Ali
You can not expect some one to write complete code for you.People here are volunteers just like you....if you need to lean how php creates tables php.net have allots of resources.
In all honesty, Khalid Ali is correct in that. What you will need is and XML file, an XSL file, a server side language, and a XSLT processor. It took me a lot of learning time time grasp the concept of using XML based solutions. They are different for each server operating system and there are many different XSLT processors, Sablotron, Xalan, Zerces, MSXML, Saxon. You can even get more detailed and create an XSD to define your XML document elements. This is not just a "code snippet" but a full blown solution. I hope that helps.
Khalid Ali
03-09-2004, 10:47 PM
Originally posted by tobyw_1969
In future, if you don't know the answer to something, and you can't be bothered to read the actual question, please don't post an unhelpful answer.
your response is extremely rude, I can only say that with this winning attitude good luck with all the free learning..
crh3675
03-10-2004, 08:22 AM
Your answer is to load the XML results into an array. Then run each value's length to determined the span. For example:
// After XML is put into array
<?
function decimalTime($val){
$vconst=1.67;
$hr=substr($val,0,strpos($val,":"));
$min=".".substr($val,strpos($val,":")+1);
$min=round((($min)*$vconst),2);
$dec=$hr+$min;
return $dec;
}
foreach($xmlentry as $entry){
// Convert Start And End Times To Decimal
$start=decimalTime($xmlentry->performances->performs->start); // Example of accessing your data
$end =decimalTime($xmlentry->performances->performs->end);
$diff=$end-$start;
$span=$diff / 25; // We use 25 since we converted to decimal time (same as 15 minutes)
print $span; // This is your rowspan
}
?>
That would calculate your rowspans. There of course would be a lot more code.