Archive for October, 2006

Getting to grips with PEAR Quickform and Smarty

Thursday, October 26th, 2006

Over the past few months, we have done a number of projects using the php Smarty package. Smarty is a fantastic templating engine which is quite easy to use and is extremely powerful. It also enforces the distinction between presentation logic and application logic and provides a great deal of flexibility when developing.

On our most recent project we decided to try and use the php PEAR Quickform module. This has also proved to be a easy to use, yet powerful form generator and processor.One thing which I think needs improving is that when forms are generated, the HTML templates are table based. I am sure that the developers of this package are trying to implement this feature on later realeases, but the package we are using doesn’t generate semantically correct HTML forms.

However, to overcome this sticking point, we combined the smarty and quickform packages to produce semantically correct HTML templates, which have validation and processing ability.

The form generation, validation form processing are extremely quick and provide an awesome amount of felxibility when it comes to both presentation and application logic.

It is truly awesome what can be acheived using open source code.
Go php!!! ;)
For those of you who are intrested in learning about quickform and smarty-check these links out:

The value of semantically correct XHTML, without using tables

Wednesday, October 11th, 2006

Ok, so I am going to use my revamping of the dating site as another topic for this post. As I identified in the previous post, we have inherited the code from a previous developer and are making improvements to the site.

The previous site was almost completely table based - yuck!! Dan Cederholm has a chapter in his book Web Standards Solutions, which is titled “Tables are evil?”. Now of course tables should be used when one is displaying tabular data, but in this case there is no tabular data on the site, maybe just some on the administrators CMS.

The “old” way of using tables for layouts is just so blotted and messy. Having tables within rows and doing styling within the code and not in the CSS, makes the site soooo difficult to manage and I am already seeing the benefits which the W3C have brought to website development.

So, some of the immediate benefits of not using tables, which I have been reminded of are the following:

  • Much less code - which means smaller files - which in turn means less space on your web server
  • Less code means less bandwidth and if you have a site with thousands of hits a day, this will have a huge impact on overall performance.
  • The ability to access the site with portable devices-mobile phones, PDAs etc.
  • It’s much easier to update layouts and styling via the CSS

I know that there are still loads of sites out there that are table based and which work perfectly. So I am not saying that it’s completely wrong to use them. It’s just that it’s so much easier not to use tables and there are lots of additional benefits which have become apparent in recent years.

The importance of good commenting

Monday, October 9th, 2006

We have been working on updating a cool dating website (well at least I think that it is cool ;)), to make it meet some of the new web 2.0 standards. The project involves revamping the original site, so we have inherited the previous code from the initial developer. I have been trying to do some backwards engineering of the code, to try and figure out how the site works. This is however proving to be quite a task because the previous developer did not put much effort into commenting and there is some quite complex code to sift through.

While I was studying, my programming lecturer always talked about the importance of commenting and he used to subtract marks from projects if the code wasn’t commented correctly. I am now realising how important a simple thing like commenting can be, especially if there are multiple developers working on a project.

I am sure that a vast majority of developers do use comments in their code and I will definetly make sure to use them more appropriately in the future