codeigniter-classloader

Codeigniter: user defined helper function does not load

浪尽此生 提交于 2019-12-23 03:59:09
问题 I made a custom helper extending the system string_helper.php. I placed it in my /application/helpers directory, called it MY_string_helper.php as required, unit-tested its functions. Now, when I try to call one of its functions from a model, it does not work. The functions in the default string helper work, instead. It looks like my extension is not loaded for some reasons. Thanks a lot, and happy holidays. Edit: even funnier. I saved the file as categories_helper.php in the system/helpers

CodeIgniter - Load libraries if not already loaded

拈花ヽ惹草 提交于 2019-12-06 01:05:33
问题 What I'm trying to do is to load libraries if they not already loaded (either CI's libraries, either custom ones) on many different points of a website. So I want to do a check on this. I have done a search on Loader library and found the is_loaded() function, so I could do this for example: if ($this->load->is_loaded('form_validation') === false) { $this->load->library('form_validation'); } The strange thing with this (with profiler enabled) is that the memory goes up, which makes me

CodeIgniter - Load libraries if not already loaded

大兔子大兔子 提交于 2019-12-04 06:04:26
What I'm trying to do is to load libraries if they not already loaded (either CI's libraries, either custom ones) on many different points of a website. So I want to do a check on this. I have done a search on Loader library and found the is_loaded() function, so I could do this for example: if ($this->load->is_loaded('form_validation') === false) { $this->load->library('form_validation'); } The strange thing with this (with profiler enabled) is that the memory goes up, which makes me wondering wether this is the correct way or not. Around line 914 in system/core/Loader.php, The Codeigniter

Calling a Controller function in another Controller in CodeIgniter

 ̄綄美尐妖づ 提交于 2019-11-26 21:16:54
问题 I have a controller "user" in my codeigniter application. This controller has a function called logged_user_only() : public function logged_user_only() { $is_logged = $this -> is_logged(); if( $is_logged === FALSE) { redirect('user/login_form'); } } As this function calls another function called is_logged() , which just checks if the session is set, if yes it returns true, else returns false. Now if i place this function in the begining of any function within same controller, it will check if