Example #1
0
 /**
  * Unregister a prefilter function
  *
  * @param callback $function
  * @return void
  */
 function unregisterPrefilter($function)
 {
     $this->_smarty->unregister_prefilter($function);
 }
Example #2
0
 * NOTE: the form template needs to be processed separately from any other
 * page templates to prevent that the form prefilter interferes with the
 * normal processing of the other templates
 */
$smarty = new Smarty();
if ($smarty->template_exists("form.tpl")) {
    $smarty->assign_by_ref("form", $form);
    $smarty->assign("title", "Form class test");
    $smarty->assign("error_message", $error_message);
    $smarty->assign_by_ref("verify", $verify);
    $smarty->assign("doit", $doit);
    $smarty->assign("mark", "[Verify]");
    $smarty->assign("credit_card_field", "credit_card_number");
    $smarty->register_prefilter("smarty_prefilter_form");
    $smarty->fetch("form.tpl");
    $smarty->unregister_prefilter("smarty_prefilter_form");
} else {
    $form->AddDataPart("<h2><center>Please copy the template file <tt>templates/form.tpl</tt> to your Smarty <tt>templates</tt> directory.</center></h2>\n");
    $doit = 1;
}
/*
 * If the form was not submitted or was not valid, make the page ONLOAD
 * event give the focus to the first form field or the first invalid field.
 */
if (!$doit) {
    if (strlen($error_message)) {
        /*
         * If there is at least one field with invalid values, get the name of the
         * first field in error to make it get the input focus when the page is
         * loaded.
         */