On 19.03.2014 12:10, Peter Kaminski wrote:
Hi Sumana,
I think a key concept you might want to capture is "separation of
concerns" -- a templating engine allows separation of presentation
logic from business logic. Often, the two are handled by different
people with different skills, in service of separate goals. So having
the templating engine specialized for presentation logic is important.
The point isn't so much that the templates look like a document, as
much as they can be written in a simplified language that's
specialized for outputting documents.
Also, I don't know if these are useful in this context, but I wanted
to point to two of the cutting-edge template engines from the PHP
frameworks world, as representatives of modern PHP template thinking:
Fabien Potencier's Twig
http://twig.sensiolabs.org/
Laravel's Blade
http://laravel.com/docs/templates#blade-templating
http://culttt.com/2013/09/02/using-blade-laravel-4/
Neither of these, though, are oriented to dual JavaScript/PHP support,
which I think is an interesting path to consider.
And last, two Wikipedia pages that might be relevant:
https://en.wikipedia.org/wiki/Web_template_system
https://en.wikipedia.org/wiki/Comparison_of_web_template_engines
Pete
MediaWiki Parser itself could be used for skinning as well with some
features disabled.
But actually just associative nested arrays are good enough as template
engine, which are used for example in Drupal:
https://drupal.org/node/930760
|// New method of generating the render array and returning that
function mymodule_ra_page() {
$output = array(
'first_para' => array(
'#type' => 'markup',
'#markup' => '<p>A paragraph about some stuff...</p>',
),
'second_para' => array(
'#items' => array('first item', 'second item', 'third
item'),
'#theme' => 'item_list',
),
);
return $output;
}|
Each key of such associative array can be mapped to view method, while
it's values are view parameters (properties). Quite flexible, fast and
powerful approach which also allows to late manipulation of Output.
Dmitriy