Re: template usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2008-10-12 at 11:09 +0200, Alain Roger wrote:
> Hi,
> 
> i would like to know if you are a lot to use PHP templates for your web
> application or web sites ?
> if yes, which one do you use (smarty, pear, yapter, phplib,...) ?
> and for which reason ? what is/are the advantages over the others ?

I use TemplateJinn :)

Unlike almost every other template engine out there it doesn't require
the framework be instantiated at runtime. It can be used to generate
static HTML files or it can be used in conjunction with InterJinn or
other frameworks. For instance, I use TemplateJinn to organize and build
my MediaWiki skins too. Usually when I create a template I pull out into
separate file logically distinct layout elements. For example the header
is in it's own template, any layout panes such as banner, left column,
right column, footer, and content area are also in their own file. Then,
I use a template that groups these together where I want them.
Additionally, for often use elements I will create a custom tag so that
I can just use a single tag to simpify and centralize rendering. An
example being MediaWiki's concept of a portlet. For these I just do:

<mw:portlet>
My content goes here
</mw:portlet>

This generates the wrapping divs for the portlet that enables easy CSS
customization and future proofs my design so that if ever I want more
elements to the portlet design I can just change the custom tag code and
recompile the skin. MediaWiki never has to know anything about InterJinn
or TemplateJinn or that the skin it is using was create via a template
engine.

Interestingly there was a recent thread about frameworks and someone
posted a blog where some guy did a benchmark using various frameworks.
Well "Hello World" if done in InterJinn would probably be done as a
static template compilation (one expects the developer to use the right
framework tool), and thus would be on par with Apache's static content
load (faster than PHP). In other words the benchmark is a load of crap
since if you use a tool properly there are ways to make it perform while
still having the convenience of a Framework. As such, TemplateJinn can
be leveraged via InterJinn so that static content pages use the same
layout as the entire site but for which the layout was generated at site
compilation time and can be requested subsequently without invoking the
PHP engine. My guess though, is that the guy would have implemented
"Hello World" with InterJinn via a module instead of using the
appropriate framework tool just so he could crap on frameworks some
more :)

The downside... for some anyways... of the TemplateJinn system, is that
you need to be comfortable editing your HTML by hand. There's no WYSIWYG
for custom tags. Personally, I prefer hand crafting my HTML layouts. I
find the browser itself to be the best available WYSIWYG.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux