Blog: The creation of the new site

Views:
37411

I thought that, seeing as this is a programmer community, the people who have not had the privilege to have access to the forums where these things were discussed or access to the code itself might be interested in knowing a bit about the underlying technology and code that powers this website. Besides, we need some content on the site ;) It is not possible to go really in-depth due to confidentiality reasons, so this will probably not be a particularly long post.

Technologies

The site is built using Zend Framework [http://framework.zend.com] which is my personal favorite PHP framework. The server is running CentOS [http://www.centos.org] with MySQL [http://mysql.com] 5.0 and PHP [http://php.net] 5.2.

Some of the code I wrote requires at least PHP 5.2. In itself that is no problem, but for some peculiar reason, the official CentOS repositories does not include the 5.2.x branch which meant we were stuck with PHP 5.1. First we considered compiling PHP 5.2.6 (current latest version) ourselves, but then I found a third party repository which included that version of PHP. You can find that repository at a site called Utter Ramblings [http://www.jasonlitka.com/yum-repository/].

Writing the code

A thing which had been wanted for a long time from the users was a unified login throughout the entire PHP Freaks. Therefore, the first thing to do was writing a login system which would use the existing user table of the forums powered by SMF. It was first considered to use SMF's SSI.php which is meant for integration with the forums. However, seeing as this would bind the site and the forums too tightly, this idea was dropped. ZF's Zend_Auth [http://framework.zend.com/manual/en/zend.auth.html] was instead used and the class PHPFreaks_Auth_Adapter_SMF was written. This also has the benefit of being able to switch to any other authentication system later if that should be needed. I think I read somewhere that SMF 2.0 will support OpenID, so perhaps that could be added to PHP Freaks when SMF 2.0 has been released and we have upgraded?

After users were able to login, it would be nice to be able to have a way to add additional information to the users' profiles, but for the reasons stated above, modifying the existing user table in SMF was not very good. Instead another user table was created and the two tables are being joined using a MySQL JOIN. The new table is populated on an on-request basis, i.e. a user profile is added when it is needed.

It was also necessary to control what users can and cannot do. For this purpose Zend_Acl [http://framework.zend.com/manual/en/zend.acl.html] is being used. The ACL is based on what group the user belongs to.

Users can now login using their existing credentials and it is possible to control their permissions using the access control list. This means that creating the actual features of this site was next: tutorials, blog posts and syndicated news. Along with those three content type, a fourth type, generic exists. An example of a such page could be the donations page [/page/donations]. All of these four types would probably share much of the same logic, so they are placed in the same table and handled by the same controller.

That is essentially how you create a "PHP Freaks". Other important things that is used from ZF are: Zend_Feed [http://framework.zend.com/manual/en/zend.feed.html] for consuming external feeds for news syndication and for generating our own feeds, Zend_Form [http://framework.zend.com/manual/en/zend.form.html] for form creation and validation, Zend_Db [http://framework.zend.com/manual/en/zend.db.html] for doing database stuff, and others...

The layout

Initially a design made by John Kleijn [/profile/448191] was chosen. The site had been almost completed with that layout when the owner of PHP Freaks, Eric Rosebrock [/profile/phpfreak], decided that it should not be used after all. This lead to one of our other members, Jeff Combs [/profile/jcombs_31], designing the layout and the new revamped logo. This design was then implemented, bug fixes were being made and code was tweaked. Eventually the site was launched (and bugs were fixed again and code was tweaked again).

Thanks to everyone who have helped with the creation of this site!