Can i do this with php?

They have: 5 posts

Joined: May 2004

Hi,

I am currently working on a website that will have different subjects in categories and within those subcategories will contain different aspects of the subject. For instance GCSE > Geography > Population. At the moment I have created separate pages for ever category and subcategories, with an example below.

http://www.kupix-design.co.uk/revisionsource/index.php?page=subjectdirectory/GCSE/design_and_tech/design_and_tech

I was wondering if there was a way to have a main template then incorporate different aspects of it into the page depending on what subject/category it is current on. For instance the main image at the top would change and the contents of the page would read from a database to display the listings for that category.

I don’t know if I am really that clear so if you need extra information about my website visit

http://www.kupix-design.co.uk/revisionsource/index.php?page=helpfaq

To read about it, which should intern give you a better understanding in what I want to achieve.

-----

Matt.

Busy's picture

He has: 6,151 posts

Joined: May 2001

I'd be very careful of using folder names in your url, it's asking for trouble.

Set your database up so you have parents and children categories, something like ?page=coffeebreak would get the page that deals with the coffeebreak and on the page displayed would also get the parent category so it looked something like Whattodo > coffeebreak

They have: 93 posts

Joined: Jun 2003

Simple solution would be what MANY sites do, it follows off Busy suggestions...

Have your index.php just be a switch for $_GET['page'].

Now with that variable place it as an include to the proper page file and create a string for the page title.

Example
switch ($_GET['page']){
case "coffee";
//Call the coffe page/query
include_once('/pages/coffee.php');
$mypagetitle = "Beans > Coffee";
}

Now you would then just place that switch in the middle of the common design elements like your header and menues.

[Design Alpha] -Web Services : Design,Hosting,Advertising,Software
Ask about custom pricing on hosting!!
Site Assets: [UltraGaming.com] [Blades of Warcraft]

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.