![]() |
Auto Loading Session Issues - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Auto Loading Session Issues (/showthread.php?tid=17583) |
Auto Loading Session Issues - El Forum - 04-08-2009 [eluser]Eric Barnes[/eluser] I am trying to build an app that will be installed by the end user and I want to create install steps. So basically if the tables do not exist go to index.php/setup The problem I am running into is I am auto loading the sessions and a global model which uses CI sessions class. I have it setup to store these in the database. So it always errors out saying the table doesn't exist. I wanted to ask if anyone had any advice? I know I can manually load these later but that is not really desired since I have lots of files that would need to be edited. I guess what I am really looking for is a way to over ride the auto loading through a hook or create the table automatically but I don't see this as being possible. pre_controller is to soon and post_controller_constructor is too late. ![]() Any advice is appreciated! ![]() Auto Loading Session Issues - El Forum - 04-08-2009 [eluser]Aken[/eluser] I'm confused - you're trying to autoload things in CI based upon variables in a database? Auto Loading Session Issues - El Forum - 04-09-2009 [eluser]Eric Barnes[/eluser] Sorry for not explaining very well. Let me try again. In autoload.php I have the session library autoloaded and the sessions are stored in the databse. So if the table doesn't exist the whole app errors out. I would like a way to have this remain autoloaded but somehow bypassed if the table doesn't exit. At that point it would forward to an install controller. Auto Loading Session Issues - El Forum - 04-10-2009 [eluser]Aken[/eluser] Gotcha! I thought it was something along those lines but clarification never hurts. With that said, I have a possible solution for you. Instead of changing the autoload, why don't you change the config items that call the use of the sessions DB? The sessions library is autoloaded by default. The user goes through the install controller, and somewhere in that process after the DB has been created, you use the following: Code: $this->config->set_item('sess_use_database', TRUE); Hope that works for you. Auto Loading Session Issues - El Forum - 04-10-2009 [eluser]Eric Barnes[/eluser] Thanks for the follow up. I ended up getting it working by not autoloading anything. Then creating MY_Controller and have it load all the ones I need. Finally only use it as the parent class in the script files and not the setup. Now it seems to work perfect. ![]() |