I learned something new today

Template engine for Pritlog

In developing the latest release of Pritlog, one major ingredient I wanted to add was a template engine. I searched far and wide on the web and came up with a big list of probably solutions. Keep in mind that I was more interested in very simple and light weight solutions and not in any full fledged template engines. This requirement is because I want Pritlog to be a lightweight blogging solution.

If you want to see the complete list of templating solutions I bookmarked, here they are:
http://delicious.com/prithish/templateengine

The below two fascinated me:

1 - Using PHP as your template engine: The author explains how the extract command in PHP can be used to create an easy solution for templating with pure PHP.

2 - The one line template engine: The author gives the solution mentioned below. I ended up using this for Pritlog and was pretty satisfied with this approach. Pritlog is still under 350 KB uncompressed with templating and plugin functionality.

I apologize if the code does not look very clean. I will see if I can get a good code highlighter gadget to use on my Pritlog.  The engine itself: 
Format of template.tpl file:
If you're not comfortable with pulling variables out of the global scope, define them as
Author: Prit -  Date: 23 Apr 2009 16:45
Tags: web -  Visits: 202 -  No Comments




Comments:

No comments posted yet!


Add Comment

Comment Form

 (Required)

 (Optional, will not be published)

 (Optional, format: http(s)://website.com)



 (2ya61qwk)