Modular Extensions - Version 4.3 |
[eluser]Delete Me Please[/eluser]
Sorry, newbie question here. How would I go about converting a library into a module? Something like an Auth library that's already been built. I'm not quite grasping the concept of Modules taking the place of Libraries... >< Don't hit me! hehe
[eluser]wiredesignz[/eluser]
Welcome to the CI forums MeanStudios. Quote:How would I go about converting a library into a module? Simply create a application/modules/{your_module}/controllers directory, drop your library into this and then edit it so its class extends the Controller class. It is now a module controller. Good Luck. ![]()
[eluser]Delete Me Please[/eluser]
Thank you! And what if it has it's own config file, where would I put that? /app/modules/{your_module}/config folder? Or is that a bad idea?
[eluser]wiredesignz[/eluser]
Hi, again. Yes every module may have its own config directory, modules use the same directory structure that CI uses for the main application.
[eluser]Sam Dark[/eluser]
Mmm? The same directory structure? Can I use languages / libraries / helpers etc.?
[eluser]Delete Me Please[/eluser]
I'm a bit confused, sorry ![]() Code: class CL_Core extends Controller Code: $this->load->module('CL_Auth', 'cl_auth') Code: $this->cl_auth->check() I hope I haven't exploaded your brain with stupid questions ![]()
[eluser]wiredesignz[/eluser]
[quote author="Sam Dark" date="1219339320"]Mmm? The same directory structure? Can I use languages / libraries / helpers etc.?[/quote] Absolutely Sam.
[eluser]wiredesignz[/eluser]
@MeanStudios, Sorry I can't help you code the module, But what you describe sounds feasible and just requires a bit of thought. One point, $this->load->module('cl_core'); is all you need to load the controller. (any second var is passed to the module constructor) Make sure the class name is Cl_core and the file name is the same.
[eluser]Delete Me Please[/eluser]
I was *just* having trouble with the class name being different than the file name ![]() ![]()
[eluser]Delete Me Please[/eluser]
If I wanted to use a function from a module in a view, how would I do that? I tried doing the Code: $this->load->module('cl_auth'); Code: A PHP Error was encountered On line 20 I'm doing: Code: $this->cl_auth->isValidUser(); |
Welcome Guest, Not a member yet? Register Sign In |