I created a custom Library in CodeIgniter, and positioned it in application/libraries/VarMatrixSpecanimal.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class VarMatrixSpecanimal {
protected $variabiliMatrix;
public function __construct() {
$variabiliMatrix['cat']['no']=1;
$variabiliMatrix['dog']['a']=2;
$variabiliMatrix['bird']['b']=3;
}
public function get_matrix() {
return $this->variabiliMatrix;
}
}
?>
Then in one controller (application/controllers/certificate.php) method I added these two lines of code:
public function save1()
{
//..... some more code before
$this->load->library('VarMatrixSpecanimal');
$numerical_values = $this->varmatrixspecanimal->get_matrix();
//..... some more code after
But when I call save1 method, I get this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Certificate::$varmatrixspecanimal
Filename: controllers/certificate.php
Line Number: 139
I don't understand where I do wrong, please help me. I checked also CodeIgniter help http://www.codeigniter.com/user_guide/general/creating_libraries.html but I was not able to get my error
Varmatrixspecanimal.phpandclass Varmatrixspecanimal {}then$this->load->library('varmatrixspecanimal');$this->load->library('varMatrixSpecanimal');but first letter of library class name must be upper case.class Varmatrixspecanimal {....}and renamed the filename toVarmatrixspecanimal.php<br/>Then I called$this->load->library('varmatrixspecanimal');..... but I got the same error