![]() |
(solved) Why I can't load MY_ libraries? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: (solved) Why I can't load MY_ libraries? (/showthread.php?tid=41968) |
(solved) Why I can't load MY_ libraries? - El Forum - 05-22-2011 [eluser]4ever[/eluser] Help please signup_form.php libraries: application\libraries\Form_create.php application\libraries\MY_Form_validation.php Code: <div id="login_form"> Returns error A PHP Error was encountered Severity: Notice Message: Undefined property: CI_Loader::$form_create Filename: forms/signup_form.php Line Number: 17 A PHP Error was encountered Severity: Notice Message: Undefined property: CI_Loader::$my_form_validation Filename: forms/signup_form.php Line Number: 18 Same as print_r($this->Form_create); print_r($this->MY_Form_validation); I can't find $this->CI is it normal? The 3 lines print_r($this->_ci_classes); print_r($this->_ci_loaded_files); print_r($this->_ci_helpers); showed that the are loaded... (solved) Why I can't load MY_ libraries? - El Forum - 05-22-2011 [eluser]Ellli[/eluser] if you have in your config file: Code: $config['subclass_prefix'] = 'MY_'; than this: Code: $this->load->library("MY_Form_validation"); // my library Code: $this->load->library("Form_validation"); // my library and as for helpers if you use them, than as i remember u don't have to use $this->. you just call the function. (solved) Why I can't load MY_ libraries? - El Forum - 05-22-2011 [eluser]4ever[/eluser] [quote author="Ellli" date="1306098531"]if you have in your config file: Code: $config['subclass_prefix'] = 'MY_'; than this: Code: $this->load->library("MY_Form_validation"); // my library Code: $this->load->library("Form_validation"); // my library Thanks for response! Yes I use prefix MY_ But nothing happaens. Still having problems: Code: <div id="login_form"> A PHP Error was encountered Severity: Notice Message: Undefined property: CI_Loader::$my_form_create Filename: forms/signup_form.php Line Number: 17 A PHP Error was encountered Severity: Notice Message: Undefined property: CI_Loader::$my_form_validation Filename: forms/signup_form.php Line Number: 18 Class is: class Form_create ... [quote author="Ellli" date="1306098531"]and as for helpers if you use them, than as i remember u don't have to use $this->. you just call the function.[/quote] Yes. As far as I know, helpers are not classes/objects and they are not placed in CI object context. That is the second problem I need to solve according previous threads of mine. But lets solve this now, because it doesn't let me to sleep. (solved) Why I can't load MY_ libraries? - El Forum - 05-22-2011 [eluser]Ellli[/eluser] well, maybe because you try loading library in view and it should be loaded in controller. (solved) Why I can't load MY_ libraries? - El Forum - 05-22-2011 [eluser]4ever[/eluser] [quote author="Ellli" date="1306099567"]well, maybe because you try loading library in view and it should be loaded in controller.[/quote] I thought about it. But $this->load->library("Form_validation"); and $this->load->helper("form"); was there in view (template) recently and the form worked. I did not do backup ![]() I also try to remove it to controller but same problem. (solved) Why I can't load MY_ libraries? - El Forum - 05-22-2011 [eluser]4ever[/eluser] Turnover! THIS WORKS! In controller * not in view Code: $this->load->library("form_create"); // SHOULD BE AUTO LOADED And now explain why. No uppercase letters even that file and class is first letter uppercase! This uppecase letters are so confusing in CI! And this uppercase syntax in controller doesn't mind: Code: $this->load->library("Form_validation"); // my library (solved) Why I can't load MY_ libraries? - El Forum - 05-22-2011 [eluser]4ever[/eluser] In view this is OK: Code: print_r($this->form_validation); In view this FAILS: Code: print_r($this->my_form_create); Conclusion: - I mustn't write the MY_ or my_ to library() and when I access my method through class. - Yet I see that no Uppercase letters in load->library() does mind. - Yet I see that no MY_ in class does matter. But I expect the class should be named MY_... Many thanks to Ellli |