I am a newb to programming, and have been able to put together a fully functional PHP/MySQL site (but since this is more of a “general question” I posted it here). I feel I did a good job at it. However, I want to take it to the next level.
When a user goes to a page, the page pulls content from the database (based on the query that I set for that specific page). This worked fine, but I have to create EVERY page/folder that is linked to, and this isn’t very efficient or user friendly. (even when using includes)
Example of folder structure
It might be best to show an example. Below is a website structure, where a ton of pages exists. Each page has a query relating to the information that it wants to pull from the database (Food, will pull ALL the food in the table; Apples, will only pull all the APPLE TYPES; and Red-Delicious will be a description page, containing only information relating to that specific row for Red Delicious Apples.)
What I do now…
As I have it now, I have to create a page and folder for EACH of these sections, and that is ALOT of work.
And, if there is an issue on one page, then I need to go through ALL the pages and make the revision. And, if the database categories change, then the entire folder structure that I use is messed up and has to be redone (with all the links)…
What I need to do…
I wanted to know if there was some way to use a master page (Foods/index.php) and have it used as a base for all the other pages/folders. And, maybe doing something with htaccess to point to those folders.
So, the htaccess may be something like… (below is what I want to do, and certainly not the code I would use… since I don’t know how to do this)
Redirect Foods/index.php?Cat1=Fruits Foods/Fruits/
Redirect Foods/index.php?Cat1=Fruits&Cat2=Apples Foods/Fruits/Apples
Redirect Foods/index.php?Items=Red-Delicious Foods/Fruits/Apples/Red-Delicious
Real life example:
When you click on an individual spell, it goes to the individual spell page…
The individual page is NOT a page that the author created. With over 400 spells, I’m pretty sure the server somehow redirects the URL to a template page.
Once again, I am new to programming and not very proficient with server-lingo. So, if you can point me to a tutorial, or tell me what I may need to ask my webhost, that would be VERY helpful. Or, try and use small words so I understand.
Let me know if you can help. Thanks.