[eluser]Alface[/eluser]
to use DMZ with HMVC I hacked datamapper libraries (system\application\libraries)
I couldn't extend without losing the functionality to make a custom datamapper's extended class for each module
actily, I think it is not even possible to extend autoload datamapper native class.
Code:
static function autoload($class)
{
// Don't attempt to autoload CI_ or MY_ prefixed classes
if (in_array(substr($class, 0, 3), array('CI_', 'MY_')))
{
return;
}
// Prepare class
$class = strtolower($class);
// Seach on application folder
// Prepare path
$path = APPPATH . 'models';
// Prepare file
$file = $path . '/' . $class . EXT;
// Check if file exists, require_once if it does
if (file_exists($file))
{
require_once($file);
}
else
{
// Do a recursive search of the path for the class
DataMapper::recursive_require_once($class, $path);
}
// Seach on Modules folders
// Prepare path
$path = APPPATH . 'modules';
if(is_dir($path) ){
if ($handle = opendir($path)){
while (FALSE !== ($dir = readdir($handle))){
// If dir does not contain a dot
if (strpos($dir, '.') === FALSE){
$modules[] = $dir;
}
}
}
}
foreach($modules as $module){
// Prepare path
$path = APPPATH . 'modules/'.$module.'/models';
// Verify if there is a models folder on Module folder
if(is_dir($path) ){
// Prepare file
$file = $path . '/' . $class . EXT;
// Check if file exists, require_once if it does
if (file_exists($file))
{
require_once($file);
}
else
{
// Do a recursive search of the path for the class
DataMapper::recursive_require_once($class, $path);
}
}
}
}
I needed to edit system\application\datamapper\htmlform.php too
turn it
Code:
// this is the default template (view) to use for the overall form
var $form_template = 'dmz_htmlform/form';
// this is the default template (view) to use for the individual rows
var $row_template = 'dmz_htmlform/row';
// this is the default template (view) to use for the individual rows
var $section_template = 'dmz_htmlform/section';
intro this
Code:
// this is the default template (view) to use for the overall form
var $form_template = '../dmz_htmlform/form';
// this is the default template (view) to use for the individual rows
var $row_template = '../dmz_htmlform/row';
// this is the default template (view) to use for the individual rows
var $section_template = '../dmz_htmlform/section';
I think it will work with any Modular Extension (ME) like Matchbox.
I didn't find any post about it on the forum, if anyone know a better way to do it, let me know