Re: Q: how to use display() for dynamic embedded tables
| From: | Andrei Zmievski | Date: | Wed, 07 Nov 2001 14:17:41 +0000 |
| Subject: | Re: Q: how to use display() for dynamic embedded tables | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1839@lists.php.net to get a copy of this message | ||
On Wed, 07 Nov 2001, Anders Janson wrote:
> I would do it like this:
> - Separate things into "modules" like you do (poll), with a separate
> template for the presentation.
> - Put a placeholder variable in the master layout template, like
> {$PLACEHOLDER}.
> - Code something like this:
> $poll = new Smarty;
> $poll->assign ("whatever", "poll data goes here");
> $poll_HTML = $poll->fetch('poll.tpl');
>
> $layout = new Smarty;
> $layout->assign ("something", "your other data here");
> $layout->assign ("PLACEHOLDER", $poll_HTML);
> $layout->display('home.tpl');
>
>
> Using {include ...} is probably not a good solution if you want to be able
> to display other "modules".
> Your master layout should not need to be modified if another module is
> used.
In our application we use {insert.. } function to insert a poll. The
benefit is that it's not cached.
-Andrei
If you find a job that you love, you'll
never work another day in your life.
- Mark Jackson