![]() |
I can use this Sigleton? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: I can use this Sigleton? (/showthread.php?tid=64929) |
I can use this Sigleton? - adrianolmedo - 04-12-2016 (models) User_model.php: PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); (helpers) user_helper.php: PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Or must I use get_instance (); ? RE: I can use this Sigleton? - wishmaster - 04-19-2016 (04-12-2016, 09:12 AM)adrianolmedo Wrote: (models) User_model.php: I do not understand why do you use additional methods like newInstance(). Just create method you need and from withing library get CI instance: (helpers) user_helper.php: PHP Code: private $CI; |