clone a webpage using php?
View Single Post
05-12-2011, 12:09 PM
Join Date: Oct 2007
Location: Manchester, UK
I think you may need to re-think your architecture, seems like to me you are using a PHP file per page? Sorry if I have the wrong end of the proverbial stick. I'm also assuming you are using a DB to populate user information.
The easiest way is like VI suggested, using mod_rewrite. To elaborate on what I think hes suggesting (and is my suggestion also).
You need to reduce all traffic to one point of access (i.e. index.php) and write a script that farms off requests to the necessary script files (for example user.php for viewing user profiles, which is what I'm assuming you are trying to achieve). After you have done this you can then use mod_rewrite to pretty up the urls.
The technique of focusing user requests to a single, manageable place is often called a front controller (amongst other names). These are usually found in MVC style applications (because it complements the technique well) and once you get to grips with it you wont want to develop without it (like MVC, TDD and all the other cool stuff I have grown to love!)
A simple overview:
obviously they can be (and often are) more complex than the examples described on that article, but it should give you a good idea of the method.
Hope that helps.
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
View Public Profile
Send a private message to sketchMedia
Visit sketchMedia's homepage!
Find More Posts by sketchMedia