Enforcing Strict ModelView Separation in Template Engines
cs.usfca.edu
cs.usfca.edu
For example the paper describes how a designer would handle submenus as follows:
To handle submenus, have the template iterate (tail-recursively) over the list of submenu items if that menu is active.
<a href=$attr.url$>$attr.title$</a> $if(attr.active)$ $attr.submenu:menuItem()$ $endif$
I prefer to send either an array to the View with the menu items and handle the logic in the template or the controller sending the list in a list with classes and id's embedded. I do not like either of them. Has anyone found a solution? I have also tried transclusion a.l.a. wikipedia to ease some of the pain of separation the designer only having to include this {{menu:top}}.
Another pet peeve of mine is that Views are more and more becoming programs (i.e ajax, Javascript?), they do not fit in neatly into a model view controller paradigm.
Whatever my comments the paper cited above by tmikew is a MUST read.
It is possible to use ajax and Javascript without getting things to mixed up, but again the discipline by the developers I am involved with is sadly lacking. There is another article I will try and find to post. Humble Dialog that fits with this paradigm.
ftp://ftp.squeak.org/docs/Self-4.0-UI-Framework.pdf