The 2.2 styling system ... feedback

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
Post Reply
User avatar
{o}
Registered User
Posts: 90
Joined: Wed Mar 31, 2004 1:26 pm
Contact:

Re: The 2.2 styling system ... feedback

Post by {o} »

Why did you implement IF, BEGIN etc. using comment syntax (<!-- blah --> ). Why don't you make use of processing instructions syntax (<?blah?>), which - I think - seems to by more logical (at least for people knowing XML)? Or - as in Smarty - {blah}, which is more uniformed, consistent?

And what do you think about this article? http://www.massassi.com/php/articles/template_engines/" target="_blank

User avatar
DavidMJ
Registered User
Posts: 932
Joined: Thu Jun 16, 2005 1:14 am
Location: Great Neck, NY

Re: The 2.2 styling system ... feedback

Post by DavidMJ »

Logical, uniform, consistent? Well, why shouldn't Smarty be consistent with us instead of the other way around :lol: !

The syntax for a phpBB template ( comment syntax ) comes from PHPLib. Although the current template engine shares zero code with the one in PHPLib, the syntax for templates remains.

As to that article.. very basic ideas on caching and template engine design. Nothing extraordinary special.
Freedom from fear

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: The 2.2 styling system ... feedback

Post by Acyd Burn »

I always shudder if i see the smarty syntax, it is far away from readable, as well as short tags or xml is. I think if you present a designer a template you have to make sure the designer is able to get the logic and being able to change it and not a programmer. HTML Comments are known to a designer, it is readable (because you see it and notice it) and editors with syntax highlighting work better with it. Smarty has become a scripting language and has IMO nothing to do with a template engine. In phpBB3 there has been more logic added, but i think it is a good weight between features/logic and useability.

Apart from this, as per David.

Image

User avatar
{o}
Registered User
Posts: 90
Joined: Wed Mar 31, 2004 1:26 pm
Contact:

Re: The 2.2 styling system ... feedback

Post by {o} »

DavidMJ wrote: very basic ideas on caching and template engine design.
Not the implementation is interesting there. Rather point of view, summarised in last sentence:
In short, the point of template engines should be to separate your business logic from your presentation logic, not separate your PHP code from your HTML code.
Well - it's true - because in many cases code MUST interact with content. Does it mean we need to invent a new scripting language, wich will be parsed by scripting language and compiled to scripting language? Adding a logic to the template engine is simply mapping of PHP features. For what? Is really

Code: Select all

<!-- IF foo eq "bar" -->
better than

Code: Select all

<? if (foo == "bar") ?>
:?:
Designer in both cases must learn the syntax - in first case he knows only what <!-- --> is, nothing else. Well, according to readability, first case is worse than second, because it is treated by editor with syntax highliting as a comment and made whole gray (for example). PHP code is highlited as a code - different color for if, different for foo. It is more readable.

And a different problem: how level of error reporting dose a template engine provide? Is debugging a template with syntax errors as easy as debugging PHP?

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: The 2.2 styling system ... feedback

Post by Acyd Burn »

I really do not know why you are even discussing this, since we will not change the template engine. :)

We think it is easier for everyone and the conditional statements were added because they were needed. The statement you quoted is not used very often, most often only loops will occur and if statements without a comparing equivalent.

And why is

Code: Select all

<? if (foo == "bar") ?>
better than (changed it, because your example is not possible at all, every variable is written in uppercase to make them more visible)

Code: Select all

<!-- IF FOO eq 'bar' -->
?

Let's break them down, ok? <!-- and --> can be removed, they are known to the designer (he at least knows that it is not printed out at the page because it is a html comment). So, the condition IF is the same for both, the variable too ("bar"), the comparing character is different, but means the same (we allow both, those wanting to add a word (eq, neq, gt, lt, or, and, etc.) and those used to use ==, !=, <>, etc.). Now with your code you have the additional confusing characters as (, )...
because it is treated by editor with syntax highliting as a comment and made whole gray (for example)
Even better. Then the template authors do not mess with the logic too much and only concentrate on their business (layout). Olympus' templates conditional statements will not changed that much, mostly it will be moved around for new variants (and to a certain extend new styles).
And a different problem: how level of error reporting dose a template engine provide? Is debugging a template with syntax errors as easy as debugging PHP?
A designer should never touch the code, what a mess this would be has been seen in phpBB1. Since coders are dictating what is available within the template the designer has no way to change the code but is still available to change the presentation. The coder gives the designer some variables (language variables are now an exception because they are globally available) and the designer can decide what he/she wants to do with it.

Also, keep in mind that the phpBB template engine has been build for phpBB, only for phpBB. It is not meant for other projects or other fields of usage. It is doing what it should do, what it was designed for.

If i look at smarty templates i always question if people are really able to distinguish between those elements "presented" and those elements which are logic dependent. But smarty might be a very bad comparison here, due to smarty being a scripting language. Anyway, this was it from me regarding phpBB's template engine... views will continue to differ regarding template engines.

Image

User avatar
{o}
Registered User
Posts: 90
Joined: Wed Mar 31, 2004 1:26 pm
Contact:

Re: The 2.2 styling system ... feedback

Post by {o} »

Acyd Burn wrote: I really do not know why you are even discussing this, since we will not change the template engine.
Just curiosity ;)
Acyd Burn wrote: Now with your code you have the additional confusing characters as (, )...
How much designers did you ask if it was confusing? :twisted: In both cases there is something to learn.
Acyd Burn wrote: Then the template authors do not mess with the logic too much and only concentrate on their business
But it is presentational logic!
Acyd Burn wrote: A designer should never touch the code, what a mess this would be has been seen in phpBB1. Since coders are dictating what is available within the template the designer has no way to change the code but is still available to change the presentation.
That makes sense 8)
Acyd Burn wrote: Also, keep in mind that the phpBB template engine has been build for phpBB, only for phpBB.
It would be great if phpBB... er... 4.0 :mrgreen: contained more portable, reusable code. Like in Open Power Board which provides completly autonomic templating engine and DBAL... I know - no feature requests :mrgreen:

Post Reply