Documentation error (register_error())
| From: | Pieter Nobels | Date: | Wed, 31 Aug 2005 18:42:07 +0000 |
| Subject: | Documentation error (register_error()) | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-2772@lists.php.net to get a copy of this message | ||
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. -- Pieter Nobels