• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
user validation_errors(); in smarty template

#1
In the normal php template the code is:
PHP Code:
<html>
<
head>
<
title>My Form</title>
</
head>
<
body>

<?
php echo validation_errors(); ?>

<?php echo form_open('form'); ?>

<h5>Username</h5>
<input type="text" name="username" value="" size="50" />

<h5>Password</h5>
<input type="text" name="password" value="" size="50" />

<h5>Password Confirm</h5>
<input type="text" name="passconf" value="" size="50" />

<h5>Email Address</h5>
<input type="text" name="email" value="" size="50" />

<div><input type="submit" value="Submit" /></div>

</form>

</body>
</html> 

In smarty

Code:
<html>
<head>
<title>My Form</title>
</head>
<body>

{form url=''}

<h5>Username</h5>
<input type="text" name="username" value="" size="50" />

<h5>Password</h5>
<input type="text" name="password" value="" size="50" />

<h5>Password Confirm</h5>
<input type="text" name="passconf" value="" size="50" />

<h5>Email Address</h5>
<input type="text" name="email" value="" size="50" />

<div><input type="submit" value="Submit" /></div>

{form}

</body>
</html>

But How I can use the validation_errors();? Smile

Thanks for the reply

I'm venturing recently with codeigniter.

Thank you for your answers.
Reply

#2
I fix this problem, I created this smarty's plugin that it can read the function Wink

functions.validation_errors.php
PHP Code:
<?php

function smarty_function_validation_errors($params,&$smarty) {
if (!
function_exists('validation_errors')) {
//return error message in case we can't get CI instance
if (!function_exists('get_instance')) return "Can't get CI instance";
$CI= &get_instance();
$CI->load->helper('form');
}

return 
validation_errors(); 
}
?>
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.