[Smarty] probléme smarty validate
Bonjour,
Je veux utiliser le plugin SmartyValidate pour traiter mes formulaires.
Mais j'ai un probléme que je n'arrive pas ŕ résoudre.
Citation:
Fatal error: Uncaught exception 'Exception' with message 'Undefined Smarty method "_get_plugin_filepath"' in /home/guillaum/web/scriptvideo/_includes/libs/Smarty.class.php:530 Stack trace: #0 [internal function]: Smarty->__call('_get_plugin_fil...', Array) #1 /home/guillaum/web/scriptvideo/_includes/libs/SmartyValidate.class.php(490): Smarty->_get_plugin_filepath('validate_transf...', 'trim') #2 /home/guillaum/web/scriptvideo/_includes/libs/SmartyValidate.class.php(199): SmartyValidate::_execute_transform('trim', 'ghk', Array, Array, 'default') #3 /home/guillaum/web/scriptvideo/_includes/libs/SmartyValidate.class.php(285): SmartyValidate::_failed_fields(Array, 'default') #4 /home/guillaum/web/scriptvideo/admin/login.php(16): SmartyValidate::is_valid(Array) #5 {main} thrown in /home/guillaum/web/scriptvideo/_includes/libs/Smarty.class.php on line 530
J'ai suivit l'exemple sur la doc.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| if( empty($_POST) ){
SmartyValidate::connect($smarty,true);
SmartyValidate::register_validator('flogin','login','notEmpty', false, false, 'trim');
SmartyValidate::register_validator('fpassword','password','notEmpty', false, false, 'trim');
}else{
SmartyValidate::connect($smarty);
if(SmartyValidate::is_valid($_POST)) {
connect();
$login = htmlentities($_POST['login']);
$password = htmlentities($_POST['password']);
if( $login == $_CONFIG['login'] && $password == $_CONFIG['password'] ){
$_SESSION['admin'] = 1;
$smarty->assign('message','Connexion réussit !');
}else{
$smarty->assign('message','Les identifiants sont incorects !');
}
SmartyValidate::disconnect();
}else{
$smarty->assign($_POST);
}
} |
Et dans mon .tpl c'est sous la forme
Code:
{validate id="flogin" message="<br />Veuillez saisir un login"}
Merci d'avance