• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Many files to include() ...how do I do this?

Riverworld

New Member
Hey all,

I'm just setting up a website for a community college (as a charity):

I currently have 200 something individual files, in folders of subject, of each course they offer.

I'm planning on using php's include() method to load them into the pages.

What I need to do is this:

1) generate links (e.g. index.php?body=courses&area=business&course=3 for each course)

2) make them all browsable by subject... so maybe determine the names of each file in each subject folder and include() each filename in the same page

How do you think the best way is to go about this, without drastically changing the current website?

Website currently is located at www.riverworld.net/1bcc-term3
 
You should retrive the variables from Url (body, area, course) with GET function and use if statements to control which will be shown (included)
But you should be careful, because simple including from url variable might be secure risky...
 
first the index page would check body, hopefully its just a few categories. then you would do a switch statement statement. You could use functions or a class for each possibility
PHP:
<?
switch($_GET['body'])
{
case "course": 
show_areas();
break;
case "etc"; 
show_etc();
break;
default:
show_intro();
}
?>

in show_area() if $_GET['area'] is empty you would use a directory script that display's the folders as categories, if $_GET['area'] is set and $_GET['course'] is empty your directory script would list off all the files in that folder. if both $_GET['area'] and $_GET['course'] is set, then you include that page in that folder
 
Back
Top