A friend and I have been working on a moderate-sized PHP website for some time now. Although we have both worked on and finished multi开发者_如何学Gople small websites (in terms of amount of code), this is our first website that has required a very large amount of code.
We have come up with our own site structure. So far, it has seemed to be working pretty well for us. However, we'd like to see some examples of what might be considered "good" PHP coding for a dynamic website.
So, are there any possibly open-source examples of well coded PHP websites that we could take a look at? I think going over a bunch of code will help us come up with better ways to organize the code for our site.
Well, I use the Symfony2 MVC framework now so, although you can use your own directory structure, I like to stick up with the one that comes with the Standard edition.
However, at the times of PHP4 (that good ol' times :D) I used almost always this structure:
- includes/ - my libraries
- templates/ - views, CSS files, images, etc.
- languages/ - application tanslations
- modules/ - basically, modules were sets of controllers in my applications
- web/ - public content (usually just a front controller)
I've always found myself pretty comfortable with this structure.
Here is a simple login system with admin features. It's a bit older but has a fair code structure that is easy to navigate. You may be able to learn quite a bit from it. This is where I learned PHP.
jpmaster77's Login System
My vote for a well-structured PHP project is the Mantis Bug Tracker. I learned a lot about PHP from tweaking and maintaining a Mantis installation. This was actually my introduction to PHP.
精彩评论