HMVC is a Hiererchical Model View Controller, where each module has it's own models, libraries, views, helpers. Each module have a unique entity, and have it's own purpose.
In comparision to MVC, the picture shows the structure:
XHMVC is Cross Hiererchical Model View Controller a structure extension for wiredesignz HMVC, allowing a more re-usable components.
Uses standard code, standard Codeginiter 2.1.3, standard HMVC 5.4, and comes with a common structure to put all your common modules to be reusable for all your codeigniter applications.
Your applications modules, controllers and models, can extend from common controllers and models, using all or part of their functionality:
In this picture, Application 1 have a module called 'other' that resides in common folder. For the welcome module, inherit the welcome controller and welcome model from common welcome module, and have it's own welcome_view.
Application 2, have it's own welcome_model, but the welcome controller and the welcome view resides in common folder. The 'other' module are all overrided.
Any combination can be made, total or partial inheritance, override part or all.
To allow an application to use a module, edit config/route.php file of your application and put the route/s as needed.
The core folder accommodates all the common modules, libraries, helpers, languages, config, meanwhile the applications folder have all the apps that can extend from common.
To extend an application to use common folder, must to have MY_xxxxxxx.php in the core folder. This programs include the Core_xxxxxxx.php programs from the common/core folder.
Inside the common/third_party folder you can find the standard wiredesignz MX folder (v 5.4)
Inside the core folder you can find the standard codeigniter system folder (v 2.1.3).
XHMVC have an Active Record cache system. XCache is a multi-purpose cache system, can save cached key pairs in files or memcache. There are also a XDBCache that overrides the CI_DB_Cache to allow the active record cache.
Once included the library:
$this->load->library('XCache/XDBCache');
You can use the cache for any active record call:
$result = $this->xdbcache->cache('QueryTest','AllCountries')->order_by('nombre')->get('paises');
The first part of the line, "$this->xdbcache->cache('QueryTest','AllCountries')" set a group of query called 'QueryTest' and an ID, "AllCountries", and returns the active record object, to allow to concatenate any active record call.
XCache includes a config/xcacheconf.php, where you can specify the TTL for this query:
$config['cache_dbquery'] = array (
'default' => 0,
'MyQueryGroup' => 60,
'QueryTest' => 60,
);
Any 'QueryTest' will be cached 60 seconds.
XCache can be used to cache any method from any model automatically. The Core_Model allow to call a method starting with '_'. If this method exists, the cache are enabled and this method is defined in 'cache_methods' section of /config/xcacheconf.php, this method will be cached. See demo3.