PHP Application Structre

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings all,

 

This question basically surrounds how you structure your PHP applications,
whether it changes depending on what you're doing and which you'd favour. I
have a feeling it'll come down to a question of personal taste, but on the
off-chance there's a best practice I'll ask anyways.

 

>From what I've seen and used, there seem to be three distinct ways of going
about it.

 

1)      Using a 'core' class which has a request handler in it. All pages in
the site are accessed through that one page, e.g.

 

http://www.somesite.com/index.php?page=ViewUser
http://www.somesite.com/index.php?page=ViewProduct

 

This is one that I've personally used most after becoming familiar with a
bulletin board system several years ago. It means that pages are easily
created as all the template/session/database handling is done by the central
class.

 

2)      Using SE friendly URL's like:

 

http://www.somesite.com/products/22012/cool-game/
http://www.somesite.com/products/22013/other-game/

 

This approach seems to be becoming more common on the sites I frequent,
however by accounts I've read it seems to be more intensive on apache as it
requires a mod-rewrite function. 

 

3)      Using different PHP files for each page:

 

http://www.somesite.com/viewproduct.php?product=....
http://www.somesite.com/viewuser.php?user=...

 

This would appear to be the least developer friendly option?

 

Hopefully someone can shed some insight into which is the recommended
approach and why. I've been building bigger and bigger sites so having a
solid foundation is becoming more and more important.

 

Thanks for any help/feedback, I hope I've been clear.

 

Alex.


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux