[eluser]BenneX[/eluser]
Hey guys, while I was trying to sleep yesterday I've got an damn nice idea about the template issue.
It's not very easy to explain it in english, so I'll give you a little example and hope you'll understand what I mean.
There aren't many different ways to display the content. There are boxes, tables, paragraphs, lists, code etc.
That means there have to be only a default of each one and the possibility to extend them or to create additional ones. I'll give a a little example - the table.
The template looks like something like that and is stored at themes/theme_name/parts/table_default.php
Code:
<!-- TABLE begin -->
{TABLE_HEADLINE}
{TABLE_OPEN}
{TABLE_CONTENT}
{TABLE_CLOSE}
<!--TABLE end -->
<!-- TABLE_OPEN begin -->
<table border="0" cellpadding="0" cellspacing="0" {TABLE_PARAMS}>
<!-- TABLE_OPEN end -->
<!-- TABLE_CLOSE begin -->
</table>
<!-- TABLE_CLOSE end -->
<!-- TABLE_ROW_FIRST begin -->
<tr class="first_row">{ROW_FIRST_CONTENT}</tr>
<!-- TABLE_ROW_FIRST end -->
<!-- TABLE_ROW begin -->
<tr>{ROW_CONTENT}</tr>
<!-- TABLE_ROW end -->
<!-- TABLE_ROW_LAST begin -->
<tr class="last_row">{ROW_LAST_CONTENT}</tr>
<!-- TABLE_ROW_LAST end -->
<!-- TABLE_COL_FIRST begin -->
<td class="first_col">{COL_FIRST_CONTENT}</td>
<!-- TABLE_COL_FIRST end -->
<!-- TABLE_COL begin -->
<td>{COL_CONTENT}</td>
<!-- TABLE_COL end -->
<!-- TABLE_COL_LAST begin -->
<td class="last_row">{COL_LAST_CONTENT}</td>
<!-- TABLE_COL_LAST end -->
<!-- TABLE_HEADLINE begin -->
<h3>{TABLE_HEADLINE_CONTENT}</h3>
<!-- TABLE_HEADLINE end -->
With a call of a function like <?=print_table($data);?> the table will be built with the given data and if theres an additional param like $tmpl_name it could be possible to load an own template like table_mytable.php to allow an other output If then it is also mudular - that means it searches first in the modules folder, then in the application folder for the template the building of templates would be very modular
Sure, it's not pretty well explained, but I hope the sense is clear ^^ If there some questions I'll try to answer them as well as possible =)