Re: [SMARTY] Re: Caching for portals?
| From: | Michal Prinke | Date: | Mon, 15 Apr 2002 20:45:37 +0000 |
| Subject: | Re: [SMARTY] Re: Caching for portals? | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3754@lists.php.net to get a copy of this message | ||
Norbert Röcher wrote:
> index.php:
> ----------
> $smarty->caching = 1;
> // these sub-templates are pulled from the cache...
> $header = $smarty->fetch('header.tpl');
> $footer = $smarty->fetch('footer.tpl');
>
> $smarty->caching = 0;
> // ...and this are db-dependent
> $news = $smarty->fetch('news.tpl');
> $poll = $smarty->fetch('poll.tpl');
>
> // building the final document
> $smarty->assign(array(
> "header"=>$header,
> "footer"=>$footer,
> "news" =>$news,
> "pool" =>$pool
> ));
>
> $smarty->display('index.tpl'); // "ugly" was yesterday...
>
> Regards,
> Norbert
...thanks, you are right, but still the PHP-coder has to care for things
that should be done by the template designer. In the ideal case,
the PHP-coder shouldn't even know how "index.tpl" is split into subparts
and which of them are cached - he should only implement the db part,
the business logic, pass some variables to the template and then, call
display() or fetch(). And that's what it's all about, "separation of
form and content is a Good Thing [TM]". ;)))
--- Michal