Although I recently released
patTemplate 3.0.0beta1 I'm still working on new features and plugins for patTemplate. My newest two projects do not touch the main code, which is in a feature freeze.
Inspired by John's
IntSmarty, I thought about implementing I18N functionality in patTemplate and came up with a solution that really resembles the one, John implemented for Smarty. To create multi-lingual websites, you just have to enclose the strings you want to translate in <patTemplate:Translate> tags. The Translate tag is a custom function, that's loaded as soon as it's used in a template, so it does not slow down the main engine. patTemplate will create a "default.ini" file, where it stores all strings that need to be translated and assigns each of these strings a unique ID. Now you copy this file to "<yourLang>.ini" and translate all strings. The next time you display the page, just set the language using $tmpl->setOption( 'lang', '<yourLang>' ); and patTemplate will use the correct language file. And in contrast to IntSmarty you do not have to know anything about the internals of patTemplate to develop this, as patTemplate allows youto register callback objects (dubbed custom functions) for new tags.
You may view the
example and the
source online. Again a big hug to
John for inspiring me to do this.
Another thing I started implementing is a compiler for patTemplate, which is just a subclass and behaves exactly like patTemplate. I only spent a few hours on this project, so it's not working like it should, but basic functionality is there and it will support nearly all features of patTemplate once it's finished.
With the stable release of patTemplate and its subpackages, Smarty will get some serious competition, as patTemplate provides the features all you Smarty users have been complaining about.