I am teaching myself web development, and right now I’m using HTML/CSS/PHP, but I am having difficulty understanding how the code for sites should be structured to avoid lots of repeat code and things like that.
I was wondering if there were some slightly complex websites that were open source, so I could view all the code (including the php) to see how things are actually done so I can create websites properly by example of these opensource sites.
If you’re considering to use MVC paradigm, I would suggest you to study how a web framework is designed and implemented (such as symfony, codeigniter, yii, ror or zend), in order to learn how a big web app is structured (requests, security, cache, logins, database, forms, etc…) and then try to design and build your own one.
This will teach you a lot of valuable concepts such as:
If you design your own framework propperly you’ll have a base structure for all your web apps, and a lot of classes for common functionalities ready to use on your site (login, forms, html, etcetera).
You don’t have to implement everything, you can use some libraries for the most complex tasks. Such as Propel or Doctrine for the ORM, or APC for the cache system, or PDO for database access, or apache mod_rewrite for rewriting urls.
I did this and learnt a lot about how to make decent web app.