Re: [PHP Template] dynamic blocks
[email protected] (Monte Ohrt)
| Newsgroups | php.template |
|---|---|
| Organization | ispi |
| Message-ID | <[email protected]> |
Ludovico Magnocavallo wrote:
>
> > No, they will be removed by the engine and will not appear on the page
> > at all.
>
> Andrei, my point is that designers will work on BARE templates, and open
> them up in netscape or ie to test layout, etc. indipendently from any
> engine or script. At least, that's what our designers do, they edit the
> templates indipendently from me, or other developers, and they edit them
> as STATIC HTML files.
>
> So the engine will NOT be there to process templates for them, and they
> WILL see the dynblocks declarations on the page, unless the developer
> masks them inside HTML comments.
>
> L.
>
Good point. We've never run into this problem, our designers always
edit the templates in a text editing program and view the pages in
their browser as seen generated by php.
So what would be a good syntax to cover this issue? I'll just
throw a couple ideas out, you can shoot them down as you see fit :-)
OPTION #1: hide the tags in HTML comments
<!-- {dynamic: row } -->
<!-- {/dynamic} -->
Pros: will hide the contents from browsers when displayed directly
Cons: A little messy looking, and a bit more info for the
template engine to parse out, a little more syntax
for a designer to learn.
OPTION #2: use normal HTML markup for template tags
<dynamic: row>
<tr>
<td>{title}</td>
</tr>
</dynamic>
<if title != "foo">
{title}
</if>
Pros: it keeps the template clean and easy to read, and the tags
will be hidden when brought up by the browser. This is also nice
for the designer, they are mostly likely familiar with how HTML
markup works, so no new tag syntax to learn.
Cons: It has a possiblity of conflicting with browser tags, like
if someone makes a CSS element called "dynamic"
Yet another idea that goes along with OPTION #2, get rid of
curly braces altogether, and use a '$' to denote variables:
<if $title != "foo">
<b>$title</b> is $$5.00
</if>
Notice double $$ to escape a literal '$'
Any other ideas?
Monte