Archive for November 4th, 2007

10 lines implementation of PHP template engine

November 4th, 2007

PHP provides the following functions.

extract($array) — import associated array as local variables. include($filename) — read PHP file and evalue it.

Using these functions, you can get your own PHP template engine in 10 lines. The following is an example.