[Typo3-dev] Better templating: PHP!
dan frost
dan at danfrost.co.uk
Mon Sep 19 10:06:34 CEST 2005
Yes - and my original point is that php is a good
language to implement any "place holders" in because
- it is quickly tested by non-TYPO3 html-ers
- it *looks* like the old html
- it is supported by lots of editors
For example, a file might look like:
<?php
<table border=1>
<tr><td colspan=2><?= $myHeader ?></td></tr>
<tr>
<td><?= $myMenu ?></td>
<td><?= $myContent ?></td>
</tr>
</table>
?>
All the html-er (note: NOT the TYPO3-er) has to do
to test this is create a file like:
<?php
$myHeader = 'blar blar blar';
$myMenu = '<ul><li>Page one</li><li>Page two....';
$myContent = '<p>this is some content</p>';
include('myTemplateFile.php');
?>
And all my extension has to do when I use this, is
use it directly.
Ok, ok - the html-er could include some logic.
There are two ways around this: 1. check the php
for logic and remove any; 2. write a parser based
on token_get_all which will block any kinds of
tokens which you don't want (e.g. T_IF, T_INCLUDE
etc).
What about this?
dan
S. Teuber wrote:
> Hi Elmar,
>
>
>>To modify a HTML-template you even need additional rights. The right
>>to alter files.
>
>
> Since altered HTML-templates should not be overwritten when updating the
> extension they belong to, it is a common best practise to make the path to
> the template configurable. This allows to place all HTML-templates in the
> fileadmin-directory (or any other filemount). You don't need administration
> rights to alter files in a filemount, every editor can do that!
>
> More important, most teams consist of specialists. There's people with
> outstanding HTML/CSS-skills, good coders, TypoScript-gurus. Some people may
> have more than one skill, but typically, at least in larger
> teams/companies, the tasks are divided like this. 'A' does the graphics,
> 'B' includes them in a HTML template, 'C' mounts the combined work of 'A'
> and 'B' into TYPO3. This workflow benefits a lot from HTML templates in
> files (opposing to some HTML in TypoScript).
>
> Seperating code and layout completely is another best practise, by the way,
> so in my opinion, it's a bad idea to include anything "functional" into a
> HTML-template, be it PHP-Code or some own reduced coding language.
>
> Sven
More information about the TYPO3-dev
mailing list