244
edits
Line 107: | Line 107: | ||
But if we can use CSS properly, all HTML output will be exactly the same with the exception of DOM identifiers when appropriate, using templating or skinning the whole app should be reduced to a matter of switching stylesheets. From there, it's just a matter of packaging your markup properly, which is not something I see us needing a separate tool for. | But if we can use CSS properly, all HTML output will be exactly the same with the exception of DOM identifiers when appropriate, using templating or skinning the whole app should be reduced to a matter of switching stylesheets. From there, it's just a matter of packaging your markup properly, which is not something I see us needing a separate tool for. | ||
=== alanjstr's take === | |||
We definitely need to move from having the html all over the php. I don't think anyone will disagree with that. Templating allows us to separate the data from the presentation. I'm all for using CSS. But the html it applies to is what we need to work on. | |||
The sidebar is an example. We have different kinds of sidebars. We have one for themes, one for extensions, one for developers ... Instead of us making a whole sidebar module that does echos, we can use a template that accepts data and turns it into presentation. | |||
Consider this example I wrote using Smarty | |||
<pre> | |||
<div id="side"> | |||
<ul id="nav"> | |||
{* This is probably better off using nested arrays *} | |||
{section name=i loop=$categories} | |||
{if $categories[i].subcats[0]} | |||
<ul> | |||
{section name=j loop=$categories[i].subcats} | |||
<li><a href="showlist.php?{$uriparamsnocat}&category={$categories[i].subcats[j].catname}" | |||
title="{$categories[i].subcats[j].catdesc}">{$categories[i].subcats[j].catname}</a></li> | |||
{/section} | |||
</ul> | |||
{else} | |||
<li><a href="showlist.php?{$uriparamsnocat}&category={$categories[i].catname}" | |||
title="{$categories[i].catdesc}">{$categories[i].catname}</a></li> | |||
{/if} | |||
{/section} | |||
</ul> | |||
</div> | |||
</pre> | |||
All we do is pass in an array of data, and the template determines how to present it. We don't clutter our code with echo statements. |
edits