Re: [SMARTY] Basic question - PHP inside templates
| From: | Nick Charsley | Date: | Mon, 17 Feb 2003 15:22:49 +0000 |
| Subject: | Re: [SMARTY] Basic question - PHP inside templates | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7801@lists.php.net to get a copy of this message | ||
It would be more in keeping with the separation of logic and design to wrap
the call and register a function i.e.
In your php code
<?php
function Banner()
{
view("468x60");
}
$smarty->register_function('Banner','Banner');
$smarty->display("....");
?>
then just drop {Banner} into the template and there it will be.
There is nothing wrong with the inclusion of php directly in the template,
but there can be many advantages to registering a function to do it for you.
You can also pass arguments to the function if need be.
nick (c)
----- Original Message -----
From: "messju mohr" <messju@lammfellpuschen.de>
To: "UKULTRA MAIL" <webmaster@ukultra.net>
Cc: <smarty-general@lists.php.net>
Sent: Monday, February 17, 2003 2:37 PM
Subject: Re: [SMARTY] Basic question - PHP inside templates
> On Mon, Feb 17, 2003 at 02:27:09PM -0000, UKULTRA MAIL wrote:
> > Hi,
> > Smarty is new to me so forgive any stupidity on my behalf.
> >
> > I'm using phpAds and I need to place:
> > <? view("468x60"); ?>
>
> {php} view("468x60"); {/php}
>
> or use
> $smarty->php_handling = SMARTY_PHP_ALLOW
> and use "<?php" instead of "<?"
>
> HTH
> messju
>
> > to call the banner. Its not working, plus I can see it in the source.
How do
> > I achieve this.
> > Cheers
> > Colin
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>