Can't load custom library in controller class extended from MY_Controller in CodeIgniter
Library class getLang { public function getText($en, $ar) { $CI =& get_instance(); $lang = $CI->session->userdata('language'); if ($lang == 'en') { $string = $en; } elseif ($lang == 'ar') { if (!empty($ar)) { $string = $ar; } elseif (empty ($ar)) { $string = $en; } } return $string; } } Controller class Home extends MY_Controller { public function test() { $this->load->library('getLang'); return $this->getLang->getText('text', ''); } } When I run home/test I get this error: A PHP Error was encountered Severity: Notice Message: Undefined property: Home::$getLang Filename: controllers/home.php L
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.