Re: embedd PHP-Code in a template
| From: | Jochen Kaechelin | Date: | Sun, 03 Mar 2002 14:12:49 +0000 |
| Subject: | Re: embedd PHP-Code in a template | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2923@lists.php.net to get a copy of this message | ||
Am Sonntag, 3. März 2002 14:55 schrieb Gabor Hojtsy:
> > Isn't it possible to embedd some PHP-Code in a template-file?
> > The following code works fine, but "HALLO" will not be shown!!
> >
> > <?
> > echo "HALLO;";
> > ?>
>
> In most cases you can embed code with more elegant ways, like
> insert functions, but if you want to embed PHP this way, use
> the <?php start element, as <? may be turned off by some servers,
> and set $php_handling in Smarty to SMARTY_PHP_ALLOW.
> Even better use
>
> {php}
> echo "HALLO;";
> {/php}
Thanx. It works now. I just found the part in the manual.
It says that is not recommended to use PHP this way - but what's
the problem when I use such a small snipplet like
{php}
echo date("Y:m:d");
{/php}
and would be the best way to embed such a small php-code?
--
Jochen