Re: [SMARTY-DEV] Documentation error (register_error())
[email protected] (Monte Ohrt) Wed, 31 Aug 2005 13:52:33 -0500
| Newsgroups | php.smarty.dev |
|---|---|
| Message-ID | <[email protected]> |
Fixed in CVS, thanks!
Pieter Nobels wrote:
> I found an error in the documentation of register_function():
>
> http://smarty.php.net/manual/en/api.register.function.php
>
> The example givven (13-1) does not work:
>
> <?php
> $smarty->register_function('date_now', 'print_current_date');
>
> function print_current_date($params, &$smarty)
> {
> if(empty($params['format'])) {
> $format = "%b %e, %Y";
> // PROBLEM:
> // Nothing gets returned
> } else {
> $format = $params['format'];
> return strftime($format,time());
> }
> }
> ?>
>
> A correct version would be:
>
> <?php
> $smarty->register_function('date_now', 'print_current_date');
>
> function print_current_date($params, &$smarty)
> {
> if(empty($params['format'])) {
> $format = "%b %e, %Y";
> } else {
> $format = $params['format'];
> }
> return strftime($format,time());
> }
> ?>
>
> I hope I posted this to the correct mailinglist, I couldn't fine a
> mailinglist specific to the docs. If not, please accept my apologies
> and direct me to the correct mailinglist. Thanks in advance.
>