Re: [SMARTY] "Smart" nesting of templates

From: Date: Mon, 10 Jun 2002 13:01:53 +0000
Subject: Re: [SMARTY] "Smart" nesting of templates
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4724@lists.php.net to get a copy of this message
At 13:35 10/06/02 +0200, 24hdev@chaoscontent.com wrote:
Now my problem is that I want to be able to display data in two ways: - display one class per page (i/e just ONE article) - sequentially display many different classes at once on the same page (i/e article on top, image somewhere, comments below). If I do the latter, the header.tpl and footer.tpl are included every time I use a new template, since the {include} function is present in all of my sub-templates.
<snip>
Of course, I could go without the {include} function in the templates and, in my PHP script, display the header.tpl FIRST, THEN display the classes and FINALLY display the footer.tpl. However, I want to keep the templates absolutely independent from my script - thus, the "template-hierarchy" must be solely defined in the templates, not hard-coded in my script.
Personally I would leave the header and footer out of those templates entirely. Classes what know how to visually represent themselves are cool, but there is no need for them to "know" about the structure of the rest of the site (i.e the header and footer files). You could have another template called "contentdisplay.tpl" or something that includes the header, then includes the template for whatever class it is meant to be displaying, then includes the footer. That way you still have completely seperate presentation without the classes themselves needing to know about the site structure. Cheers, Simon

« previous php.smarty.general (#4724) next »