Page 1 of 1

Class Schedule type script

Posted: Mon Aug 29, 2005 4:24 pm
by cheerio
hi emm i'm trying to make a script that shows a class schedule. I have a text file with the different periods with a seperator: |line|
classes.txt:

Code: Select all

1,spanish,sendon,24
|line|2,CADrockets,monaco,35
|line|2,GR artsweb,convery,44
|line|2,multimedia,verger,2
|line|3,LA,horn,29
|line|4,SS,degen,40
|line|5,alg j,kitchen,45
|line|6,guidelunch,sendon,24
|line|7,PE,reck,gym
|line|7,Proj Adventure,Mealey,gym
|line|8,Science,Sudol,42
and this is the php script i want to setup a table that shows period, class description, teacher, room # (the format you can see in classes.txt)

Code: Select all

<?php
$file = "classes.txt";
$getfile = file_get_contents($file);
//below: i want to separate each period with explode:
$classes = explode("|line|",$getfile);
//this is like where i dont know what to do which is wehre i need help
foreach($classes as $c) {
$d = explode(",",$c);
}
?>
sorry for not explaining liek exactly what i want so well but if anyone knows what im trying to do please help

Posted: Mon Aug 29, 2005 5:07 pm
by feyd
you have the basic idea.. $d will be an array of the values from each line..