News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Why Not Use PHP's Alternate Syntax For Templates?

Started by user2037, September 20, 2007, 08:05:19 AM

Previous topic - Next topic

bloc

Interesting discussion - and strangely enough i have been toying with an idea I think will be better in this. Its partly what Grudge mentioned: a simplified language for templates which can be complied into a normal template. All the benefits of pure php, but much simpler in coding. Currently its in its infancy, but this is a code example from it:

{top}
<div class="tborder">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="catbg" height="32">{forumlogo}</td>
<td align="right" class="catbg">
<img src="{image_url}/smflogo.gif" style="margin: 2px;" alt="" />
</td>
</tr>
</table>
{memberinfo}
{news&search}
</div>
{mainmenu}
<div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">
{content}
</div>
{copyright}
{bottom}


Every bracket will have its php counterpart, some will need further subcode-bits to further customise that bit, but thats the general idea: to allow levels of complexity, just after what you need. As one can see, it can even be edited in Dreamweaver at ths stage lol ;D

But the html here is really not perfect, it should be as much adjustable as possible, meaning more semantic correct and as little use of tables-for-layout as possible. Its also -crucial- to have everything adjusted by css, as this type of "super-template" will not let you tinker with the smaller html details, css will be the only way(and the best way)

....to adress another point cropping up here: the templates in their current form do require conversion to better html/css support and accessibility issues. Thats what we aim for in SMF 2.

Rudolf

Quote from: karlbenson on October 20, 2007, 01:16:20 PM
It is impossible to put 100% of the javascript in js files.

Especially where AJAX is concerned, this is because all the language strings and url/uri/folders need to be defined in the page.
That is the only real way to pass php variables/language strings to javascript.

Then put the javascript in php files :P
The point is not having "dynamic" js separate from the templates, it is to have clean html templates where AJAX is not a concern.
Where AJAX is concerned all this debate is useless because once you start ajaxifying the interface, it stops to be static, and programming comes into play. By definition you can't make it user-friendly. You can separate the controller (the js part) from the view, but the controller has to understand the view. In poor words it means that if you change the view (in this case the page structure) the controller will break. To be able to change the view you'll need knowledge of the controller (ie: the display page).
In this case the only (not so) safe choice of a "3 years old child" to change how the ajax page looks is the CSS.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Dannii

QuoteIt is impossible to put 100% of the javascript in js files.

Especially where AJAX is concerned, this is because all the language strings and url/uri/folders need to be defined in the page.
That is the only real way to pass php variables/language strings to javascript.
These things could be detected if you wanted to do 100%, although realistically 99% is fine.
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Advertisement: