[eluser]Mareshal[/eluser]
problem was solved with a model.
Edit: I think wasn't solved. Something is not working:
I have in my model this:
Code:
<?php
class Dates extends Model{
function Dates(){
parent::Model();
}
function diff($date1 , $date2){
$result = 0;
if( $date1 >= $date2 )
$result = $date1 - $date2;
else
$result = $date2 - $date1;
return $result;
}
}
?>
and in views/main_index.php I have this:
Code:
$this->load->model('dates');
echo $this->dates->diff("12", "23");
and doesn't want to work.
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$dates
Filename: views/main_index.php
Line Number: 6
Fatal error: Call to a member function diff() on a non-object in E:\xampp\htdocs\em\system\application\views\main_index.php on line 6
In my controller if I write the last code is working, but in views...