A Simple Yet Powerful PHP Template Engine

This is not yet another regular expression replacement template engine. The template engine uses PHP itself to render the template. The template itself is very intuitive to people who are already familiar with PHP. There is no extra learning for additional syntax - the template code itself is just plain PHP code. Though I haven't done any benchmark, from my past experience of using it, it is pretty fast - consider that it consists of less than 100 lines of code. Thinking of using Smarty?
Continue reading

Tableless Image Gallery – An Experiment of Fluid Grid

Today I want to build a tableless image gallery. The motivation came from a web project I am currently doing. In one of the web pages I am coding, I need to make a grid layout and put image thumbnails in it. I started off by using table to layout the grid. Although it turned out nicely, the gallery itself is not very friendly to DOM manipulation. For instance, when removing a table cell during a delete operation using Ajax, a hole remains in the gallery.

I told myself that there must be a better way to do this. So I started experimenting tableless grid layout. It took me a while, but I am quite satisfied by the result. You can take a look how the finish product looks like or download sample layout files. For illustration of deletion using Ajax, I used jQuery to perform a simple DOM removal operation, which removes a clicked cell off the grid. While you are testing the online example, look closely how the gap is being filled when a cell is removed. I've tested it in IE 6 and Firefox 2.0.0.7, and both worked like a charm.

Continue reading