Create pages code

mandude

Senior Member
Jr. VIP
Joined
Feb 18, 2008
Messages
1,054
Reaction score
409
Hey, I am trying to figure something out. I know its possible, not sure if all of it is though.

I am creating a website, and the home page will have links on it to different pages. each subpage has a product on it, with pic, description, name. I know you can easily get a template subpage to call <get> function to get the info from a file.

But how can I go about so I dont have to make a million subpages, is there a way that some code can create the page as it calls it from the home page? For example, home page has a link to productz.php, but productz.php doesnt exist cuz it was never called before. Clicking the link creates a php page, site.com/productz.php and it gets the required info from productz.txt and picture from picz.jpg or etc.

Is this possible? More so, can someone help me figure out the code?

Thank you in advance!
 
You can use .htaccess to change every calls like this one:
Code:
http://domain.com/blablabla.php
to:
Code:
http://domain.com/index.php?page=blablabla

In index.php you have to have code that is checking if GET array value ($_GET['page']) is empty or no.

If it's empty=>show homepage
If it have some value like "blablabla" search in folder (for example) "InfoTexts" file "blablabla.txt". If file exist open it and use all info that are in it.
If no=>404 redirect
Search in folder "InfoImages" file "blablabla.jpeg". If exist - use it. If no - That's OK xD

Very simple and easy to implement.
 
Back
Top