CodeIgniter Forums
Dynamic autoload.php (how to get values from database?) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Dynamic autoload.php (how to get values from database?) (/showthread.php?tid=2479)



Dynamic autoload.php (how to get values from database?) - El Forum - 08-07-2007

[eluser]koniciwa[/eluser]
Facing a situation now where I need to allow users to customize the loaded libraries from autoload. These values are stored in the database. The problem is that the database is only loaded after processing the autoload.php file and not before, leaving me with mysql_query() to do the task of retrieving from database. I'm just wondering if there's a better way to do this?

Thanks


Dynamic autoload.php (how to get values from database?) - El Forum - 08-08-2007

[eluser]Michael Wales[/eluser]
Just add your own library loading function to the Controller constructor that pulls the libraries you want to load from the database via Active Record (if that's the route you want to take - I assume so, since you don't want to use mysql_query()).


Dynamic autoload.php (how to get values from database?) - El Forum - 08-08-2007

[eluser]koniciwa[/eluser]
Thanks for pointing me in the right direction.
I've looked everywhere but the obvious Smile

The loader has been ported to a library which is called by a hook. Works great, though I've yet to find the right loading sequence.