Re: embedd PHP-Code in a template
| From: | Gabor Hojtsy | Date: | Sun, 03 Mar 2002 15:12:58 +0000 |
| Subject: | Re: embedd PHP-Code in a template | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2925@lists.php.net to get a copy of this message | ||
> 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?
As I said, in most of the cases you can do the task
much easier with other features. In this case:
{$smarty.now|date_format:"%Y:%m:%d"}
This is the same as your PHP code above.
A similar example is in the manual. $smarty.now
is a built in variable, date_format is a modifier,
%Y:%m:%d is the same format you used in your
PHP code (just all formatting letters are preceded
by a %).
Goba