Re: smarty
| From: | Chris de Vidal | Date: | Wed, 07 Apr 2004 14:43:10 +0000 |
| Subject: | Re: smarty | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182641@lists.php.net to get a copy of this message | ||
Kelly Hallman said:
> Going even one step further (the beauty of Smarty: always another level),
> just extend the Smarty object itself. Then, instead of making all your
> templates includes other templates (such as a header or a footer), you can
> make your overall page be a template, and the extended Smarty object can
> be given extra functionality to control the page:
>
> {* MyPage.tpl -- Smarty template for the entire page *}
> ...header...
> {include file=$content}
> ...footer...
>
> // mypage.php -- extended Smarty object
> class MyPage extends Smarty {
> var $tmpl = 'MyPage.tpl';
> function render($x) {
> $this->assign('content',$x);
> $this->display($this->tmpl); } }
>
> // actualphpcode.php -- called by the browser
> $pt = new MyPage;
> $pt->render('pagecontent.tpl');
Sorry, I'm feeling better now but still don't understand what you're
telling me/us. Could you please expound? What functionality does this
afford?
/dev/idal