Templating engine idea

Submitted by Anonymous on Mon, 01/21/2008 - 20:41
Written by
RaZ

An idea to add some more logic and structure into templating.

For instance: Quick Reply

This is always part of a topic template. Why not use switches in the templating system?
Something like:
view_topic.tpl

<div id="forum">
[..]
some title stuff, breadcrumbs,category, new topic, new reply, etc..
[..]
<div id="topic_title">{$title}</div>
{begin_loop_posts}
<div id="{post_id}>
...
</div>
{end_loop_posts}
{if_quick_reply}
<div id="quick_reply">
markup goes here
</div>
{enfid_quick_reply}
..
some other shit here
..
</div>

Using these if's in templates, you can really template everything you want.
When the template is parsed, the parses checks if the quick_reply should be shown or not.

In this case, the designer has complete control over the lay-out, and the position where he/she wants the information.

This idea isn't mine, I've seen it in a CMS, and have templated it. The power and the control the designer has, is endless..

What you are suggesting here has been on the list for UseBB 2 since years. In fact, it was decided to use template files in PHP but allow other systems (such as Smarty) to be used. See the mailing list.