Rendering to smarty with custom required/error templates producing smarty error
| From: | Adam Hubscher | Date: | Mon, 06 Dec 2004 00:59:33 +0000 |
| Subject: | Rendering to smarty with custom required/error templates producing smarty error | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-16031@lists.php.net to get a copy of this message | ||
Ok, thanks to y'all helping me find my stupid stupid mistake from before,
now I come to one that I really have no idea why its happening.
I produce this warning, after outputting the smarty template:
Warning: Smarty error: eval: missing 'var' parameter in
f:\PHP\Smarty\libs\Smarty.class.php on line 1088
Now that I have the rules 100% working, I have the issue of displaying them
from within the smarty template. I defined the custom templates after
setting up the renderer, like so:
$this->renderer->setRequiredTemplate(
'{if $error}
<font color="red">{$label}</font>
{else}
{$label}
{if $required}
<font color="red" size="1">*</font>
{/if}
{/if}'
);
$this->renderer->setErrorTemplate(
'{if $error}
<font color="orange">{$error}</font><br />
{/if}
{$html}'
);
$this->form->setRequiredNote(
* This field is mandatory');
(this of course, being a basic one, since I've had problems with it just
wanted to get it to work first)
Since this is my first time actually using quickform with smarty, I
consulted the starter written by the linux consultancy. However, utilizing
his demo code, this doesnt work. I thought it might be with the fact that
its using generic {$variable} terms, and not actually referring to the
smarty form variable... however, afte attempting to add the $form.variable
change to it, it still would not produce anything but that warning. It also
does not produce any label output on the form, only the elements.