PDA

View Full Version : New method for handling errors


Peter
02-23-2007, 07:02 PM
Nice consistant method to handle errors in upcoming versions of ILance


$error = 'Some error here';
$error2 = 'Another error here';

$errors[] = array(
'error' => $error,
'error2' => $error2
);


Then display in such format:


$show['errors'] = false;
if (!empty($errors))
{
$errorlist = '';
foreach ($errors as $error)
{
$errormessage = $error['error'];
eval('$errorlist .= "' . fetch_template('errormessage') . '";');
}
// if condition within template to show error template or not
$show['errors'] = true;
}

wterpilo
02-24-2007, 09:09 AM
Nice, that should help us to make software more user friendly. If something is wrong user will see error. Now it's just not working and user doesn't know why.

Peter
02-24-2007, 04:30 PM
Did you notice this line:

eval('$errorlist .= "' . fetch_template('errormessage') . '";');

This will actually load ./templates/[template_folder]/errormessage.html

This inside this template will look like this:


<li>$error</li>
<li>$error2</li>

:D