Re: Question about template systems
| From: | Ross McKay | Date: | Tue, 03 Mar 2009 23:40:30 +0000 |
| Subject: | Re: Question about template systems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289205@lists.php.net to get a copy of this message | ||
On Tue, 3 Mar 2009 20:46:40 +0000, stuttle wrote:
>[...]
>As far as templating systems go I personally don't think they add anything
>to the equation unless you're working with designers who are already
>familiar with something. Separation of logic and content is important,
>abstraction away from PHP is not (IMHO).
Yeah, I've been meaning to ask about that myself - what benefit is there
in using something like Smarty, which requires learning yet another set
of notation, over just having a class/interface for the page and calling
methods on that in plain-old PHP from the template?
--- the PHP page (e.g. index.php) ---
<?php
$page = new YourPageClass();
require_once 'include/template.php';
--- template.php ---
<html>
<head>
<title><?php $page->showPageTitle();?></title>
...
<?php $page->showCustomHeaders();?>
</head>
<body>
...
<?php $page->showMenu();?>
...
<?php $page->showContent();?>
...
</body>
</html>
--- snip ----
For that matter, why go with Smarty over the more widely supported
(across multiple languages) XSL?
Maybe I'm missing something, but I don't see the point of special
templating systems that require you to know yet another notation set,
i.e. abstraction away from PHP as Stuart puts it.
--
Ross McKay, Toronto NSW Australia
"Click me, drag me, treat me like an object"