Re: [SMARTY-DEV] feature request
| From: | Monte Ohrt | Date: | Mon, 05 Jan 2004 17:58:34 +0000 |
| Subject: | Re: [SMARTY-DEV] feature request | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2030@lists.php.net to get a copy of this message | ||
On Mon, 2004-01-05 at 11:29, Mark Rogers wrote:
> Putting the module into a custom function moves the presentation
> of the module into the code, not in the template, which completely goes
> against the code separation principle.
It doesn't necessarily move presentation to the code, you can still use
templates to present the output of the function. In my case I use a
function only for grabbing the content, not displaying it. Example:
{get_article_info id=$art_id assign="art_info"}
{* art_info now contains my article information *}
<b>{$art_info.title}</b><br />
{$art_info.subtitle}<br />
<i>{$art_info.byline}</i>
In the case your function must take data and wrap it around some
presentation yet you still want to keep the presentation control in a
template, you can pass a path to your template to the function:
{show_article id=$art_id template="article.tpl"}
You certainly want to avoid hard-coding presentation elements in the
function unless the function is specifically meant to do so.