Simple HMVC |
When I started this thread I stated that it would not be possible to directly route a request to a module. But when using the _remap() method in, for example MY_Controller, you can map a request to a module.
I needed this as my CMS is fully module based and I don't want to create a “main” admin controller for every module used in my CMS. Here is what I have done: I created a MY_Controller file with two classes defined within this file. The classes are WEBSITE_Controller and ADMIN_Controller. The ADMIN_Controller has the following _remap() method PHP Code: class ADMIN_Controller extends CI_Controller { This will now try and find a matching module/controller and method/value based on the URI and execute it if found. The output is then passed to the index method of my admin controller. The params I use are gathered in a MY_URI class. See code below: PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); I only use this for my CMS. My WEBSITE_Controller uses a page builder to render the content of a DB page and will execute any module that is found on the requested page. For more info on routing DB pages check out my other thread |
Messages In This Thread |
Simple HMVC - by Martin7483 - 09-23-2015, 03:46 AM
RE: Simple HMVC - by Martin7483 - 09-24-2015, 02:41 AM
RE: Simple HMVC - by skunkbad - 09-24-2015, 01:35 PM
RE: Simple HMVC - by Martin7483 - 09-24-2015, 11:02 PM
RE: Simple HMVC - by Martin7483 - 09-25-2015, 02:15 AM
RE: Simple HMVC - by kenjis - 09-25-2015, 05:04 AM
RE: Simple HMVC - by Martin7483 - 09-25-2015, 05:10 AM
RE: Simple HMVC - by mwhitney - 09-25-2015, 06:54 AM
RE: Simple HMVC - by Martin7483 - 09-25-2015, 06:59 AM
RE: Simple HMVC - by kilishan - 09-25-2015, 07:08 AM
RE: Simple HMVC - by Martin7483 - 09-25-2015, 07:20 AM
RE: Simple HMVC - by Martin7483 - 10-15-2015, 04:24 AM
RE: Simple HMVC - by nasser.man - 10-15-2015, 12:13 PM
RE: Simple HMVC - by Martin7483 - 10-16-2015, 01:54 AM
RE: Simple HMVC - by Sentro - 10-30-2015, 01:37 AM
RE: Simple HMVC - by Martin7483 - 10-30-2015, 01:48 AM
RE: Simple HMVC - by Sentro - 10-30-2015, 02:10 AM
RE: Simple HMVC - by Martin7483 - 10-30-2015, 02:15 AM
|