View Single Post
Old 05-12-2011, 12:09 PM   #8 (permalink)
sketchMedia
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

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:
http://www.w3style.co.uk/a-lightweig...ller-for-php-5

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)
sketchMedia is offline  
Reply With Quote