Warning in Smarty 2.3.0
| From: | Hinrich Donner | Date: | Wed, 27 Nov 2002 17:02:36 +0000 |
| Subject: | Warning in Smarty 2.3.0 | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6572@lists.php.net to get a copy of this message | ||
Hi,
I have a warning when using smarty:
---[cut]---
function smarty_function_systemmessages($params, &$smarty)
{
// Init defaults
//
$result = '';
// Assign all messages
//
if (!$smarty->messages->isEmpty()) {
// Get a proper template
//
if (is_array($params) && array_key_exists('template', &$params))
$template =& $params['template'];
else
$template = 'system/systemmessages.tpl';
// Assign the messages
//
$messages = $smarty->messages->get();
$smarty->assign('messages', &$messages);
// Create the result
//
$result = $smarty->fetch(&$template);
// Remove the messages
//
$smarty->clear_assign('messages');
}
if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $result);
} else {
echo $result;
}
}
---[cut]---
I derived a class from Smarty and appended some objects. The object
"messages" does store text messages with time stamps in a session. The
method get collect all data from the session and assign them. Also the
gotten messages are removed from the session. It is to pass some debug
messages to the output.
I'm using error_reporting(E_ALL). The warning is:
Warning: Undefined offset: 0 in
/usr/local/httpd/www.phportals.de/includes/smarty/Smarty.class.php on line
1131
I'm using Smarty 2.3.0.
Regards, Hinrich
--
Hinrich Donner