I am trying to display error messages by assigning the SMARTY variable $error in the form of:
function validate1() {
$error['title'] = "Title contains illegal characters...";
$this->smarty->append('error', $error);
}
function validate2() {
$error['time'] = "Please enter a time in 12 hour clock (12:30 PM) format.";
$this->smarty->append('error', $error);
}
My HTML looks like:
<p class="message-error">{$error['title']}</p>
<p class="message-error">{$error['time']}</p>
I had recently been using the code below, which works; is there any way that I can modify the first block of code to work the same as the code below?
$error['title'] = "Title contains illegal characters...";
$error['time'] = "Please enter a time in 12 hour clock (12:30 PM) format.";
$this->smarty->assign("error", $error);
Does it work if you define the array this way and include the merge option (3rd param to
append())EDIT Forgot to include the merge parameter.