Class Schedule type script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cheerio
Forum Newbie
Posts: 18
Joined: Sat Aug 13, 2005 4:52 pm

Class Schedule type script

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you have the basic idea.. $d will be an array of the values from each line..
Post Reply