* Ashar Voultoiz <hashar+wmf(a)free.fr> [Tue, 07 Dec 2010 19:19:53 +0100]:
On 06/12/10 16:57, Trevor Parscal wrote:
I personally think XSL is awesome, and would
defend it with
vigor.
I love XSL too. Probably the easiest way to render an XML data file.
It's easy only when XSL style sheet already exists. Even simple loops
were not so easy to peform in that language, at least in old v1.0 I've
used some years ago. And expressions enclosed in tags are bloated.
XQuery has easy loops and much less bloat, however it's much less
supported in PHP.
Another approach could be inspired by ruby on rails
way. You define a
general application layout using HTML with special directives such as:
<html>
<body>
<%= yield %>
</body></html>
"yield" is where the current view should be inserted. This mean a
graphist / skinner, just have to know about HTML/CSS :-b
To create your view, you use rhtml (ruby html) which is plain HTML in
which you can insert ruby code using <% %> or <%= %> :
<html><table>
<% @articles.each do |article| %>
<tr>
<td><%= article.title %></td>
<td><%= link_to 'Show', article</td>
<td><%= link_to 'Edit', edit_path( article )</td>
</tr>
</table></html>
It does make thing easier, since the whole backend is hidden. Its
role
is just to provide the correct variables (in the above
case 'article'
which is an array of articles objects).
Not bad. BTW, a good skin templating probably could also become an
alternative wiki templating for wiki articles.
Dmitriy