![]() |
Modular Separation - PHP5 (Modules) - 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: Modular Separation - PHP5 (Modules) (/showthread.php?tid=20208) |
Modular Separation - PHP5 (Modules) - El Forum - 03-17-2011 [eluser]wiredesignz[/eluser] Try with the module name also. Code: $this->load->view('sample/sample/some_view'); Modular Separation - PHP5 (Modules) - El Forum - 03-17-2011 [eluser]Keat Liang[/eluser] [quote author="wiredesignz" date="1300378455"]Try with the module name also. Code: $this->load->view('sample/sample/some_view'); oh that solve the problem. thanks a lot ! Modular Separation - PHP5 (Modules) - El Forum - 03-30-2011 [eluser]Noor[/eluser] Why Modules::run() doesn't working. Here is my code modules/home/controller/home.php Code: class Home extends MX_Controller { Code: <h1>Welcome to CodeIgniter!</h1> Code: class Test extends MX_Controller { and in the log file I get this error ERROR - 2011-03-31 08:22:16 --> Module controller failed to run: home/test Help please Modular Separation - PHP5 (Modules) - El Forum - 03-30-2011 [eluser]wiredesignz[/eluser] Your code is attempting to run the home controller test method. Try: Code: <?php echo Modules::run('home/test/index'); ?> Modular Separation - PHP5 (Modules) - El Forum - 03-30-2011 [eluser]Noor[/eluser] [quote author="wiredesignz" date="1301553424"]Your code is attempting to run the home controller test method. Try: Code: <?php echo Modules::run('home/test/index'); ?> Thanks, it's working now. But, should I always type method name? including index method? Modular Separation - PHP5 (Modules) - El Forum - 03-31-2011 [eluser]Noor[/eluser] I can not run controller with same name even though the module is different. modules/events/controllers/latest.php Code: class Latest extends MX_Controller { Code: class Latest extends MX_Controller { Code: <?php echo Modules::run('news/latest/index'); ?> several latest news several latest news Why? Modular Separation - PHP5 (Modules) - El Forum - 03-31-2011 [eluser]wiredesignz[/eluser] Why?, Because PHP does not allow you to load two classes with the same class declaration. Modular Separation - PHP5 (Modules) - El Forum - 04-03-2011 [eluser]Element 80[/eluser] Is there currently any built-in method with the system to return a list of available modules? I'm trying to figure out a way to create a sort of user-side pick-and-choose module manager, so that if I have a module for an RSS feed and a module for a mailing list, user A can opt for the RSS, user B can opt for the mailing list, and user C can go with both, but I need to know that the modules exist first to give them the choice. I also want to make sure I'm not misusing this - "core" Controller, Model and View files for my system can/should still be run from the original application/____ folders and not application/modules/[so forth], right? I assumed this was the case, though the example on the wiki made this a little unclear. Modular Separation - PHP5 (Modules) - El Forum - 04-03-2011 [eluser]theprodigy[/eluser] Quote:Is there currently any built-in method with the system to return a list of available modules?The way I've handled this before was to keep track of everything in the database. You can build a "modules" table, with columns for name, folder_name, and active. The difference between name and folder_name are: Name: Human readable Folder_name: the actual module folder name This is so you can give your users options for 'RSS' and "Maillist", but name your modules 'rssfeed' and 'mail_list'. The active column is a boolean field, so you can turn access to your modules on and off. If you don't want to go the database route, the only other options I can think of is to do a scandir of the modules directory, then loop through the returned array using is_dir to make sure the current element is a directory, and not a file (make sure you also check for '.' and '..'). Modular Separation - PHP5 (Modules) - El Forum - 04-03-2011 [eluser]Element 80[/eluser] That's essentially what I want to do, but I need to know the plugin exists before it can be added to the database. Preferably, I'd like to be able to make adding modules in as simple as dropping the module into the directory and running an "Update modules" method. It sounds like the best way to do this would be the scandir method you outlined? |