[Koha-devel] template system abuse

Pierrick LE GALL pierrick at koha-fr.org
Tue Apr 25 10:09:13 CEST 2006


Hi koha-devel,

On Thu, 13 Apr 2006 11:20:58 -0400
"Kyle Hall" <kyle.m.hall at gmail.com> wrote:

> This discussion made me think of a great article I read awhile back.
> 
> http://www.massassi.com/php/articles/template_engines/

This article is interesting. Here is how I understand and conclude
about it: you can understand template engines two ways, the first way
is to separate HTML code from scripting code (Perl, PHP, WhatYouWant),
the second way is to separate business logic from presentation logic.

If you want to separate HTML and Perl, you need a basic template
engine with var replacement and block iterations (no "if/else"). This
is a good way to see templates for pure HTML designer.

If you want to separate business logic from presentation logic, you
need an advanced template engine:

- conditionnal if/elsif/else
- pagination systems
- localized strings access

For example the capacity to toggle lines color in a table. Such
advanced template engines exist but many people think that you'd better
use the scripting language, because it's useless to learn a new
language and it degrades performances.

Now returning to Koha, I think we have a template engine in the
middle : we have if/else but no conditions and we clearly can't
separate business logic from presentation logic ($toggle is one
example but there are others).

My personnal experience is to work with a very simple template engine,
without if/else and it works fine. I've never participated in a project
using an advanced template engine, so I can't really say if it is the
solution to all presentation related problems.

Bye

-- 
Pierrick LE GALL
INEO media system





More information about the Koha-devel mailing list