[Typo3-dev] Smart Content Rendering
Ingmar Schlecht
ingmar at typo3.org
Thu Oct 27 04:26:07 CEST 2005
JoH wrote:
> Well - if this is the logic behind your decisions against one of the most
> powerful things TYPO3 has to offer:
First of all, sorry for the confusion:
I didn't mean to say
"TypoScript is bullshit because"
but
"Something I don't like about using TypoScript properties for
templating is..."
In fact I think TypoScript is quite a handy configuration language, very
short and easy to write. Also with things like the TS property lookup
browser it's easy to find properties that you know but forgot how to
spell them exactly.
I just meant content rendering, templating. I think that for that,
TypoScript should be avoided, so no HTML tags should be contained within
TypoScript, but rather in an external template file - be it a
###MARKER### template or -- because it can take care of logic as well --
a very basic PHP file looking roughly like that:
<h3><?= $header ?></h3>
<div>
<ul>
<?php foreach($rows as $row) { ?>
<li>
<?= $row['image'] ?>
<?= $row['caption'] ?>
<li>
<?php } ?>
</ul>
</div>
instead of
<h3>###HEADER###</h3>
<div>
<ul>
<!-- ###ROWS### begin -->
<li>
###IMAGE###
###CAPTION###
<li>
<!-- ###ROWS### end -->
</ul>
</div>
I think the PHP example above doesn't look much more complicated then
the ###MARKER### template, but is more flexible.
The only problems I see in using PHP for such templating tasks are:
- Security: The designers who create the template have can do all PHP
offers, i.e. read out the DB password
- It might invite people to start putting "business logic" into those
templates, although that's not what they're meant for.
Smarty is exactly built to avoid those two problems, but then again, you
have to learn a whole new language...
If it was possible to restrict the available PHP functions in an
included PHP file, I reckon the PHP way of templating would be pretty
much perfect.
cheers,
ingmar
More information about the TYPO3-dev
mailing list