CodeIgniter Forums
HMVC 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: HMVC Modules (/showthread.php?tid=48296)

Pages: 1 2


HMVC Modules - El Forum - 01-11-2012

[eluser]Ordos[/eluser]
This extension for CodeIgniter enables the use of the Hierarchical Model View Controller(HMVC) pattern and makes your application modular. This allows easy distribution of independent components (MVC) in a single directory across other CodeIgniter applications. All modules are grouped in their own folder and can have their own controller, model, view, library, config, helper and language files.

Since the introduction of CodeIgniter 2.0 there has been support for packages built right inside CodeIgniter. This extension utilizes this but adds the extra functionality you need for full HMVC support. Therefore it was not needed to change the main CodeIgniter core files, but only wrap them with package functions.

It is inspired by wiredesignz's HMVC extension, but it does not change CodeIgniter's core files as much and is a lot smaller.

You can download the code from github, as well as the readme: https://github.com/segersjens/CodeIgniter-HMVC-Modules

If any functionality is missing, please contact me and I will do my best to add it.


HMVC Modules - El Forum - 05-01-2012

[eluser]bralens[/eluser]
Hello
I'm using this extension with Datamapper.

Everything forks fine but when i use
Code:
$this->load->controller('address/streets/view');
and within called controller use
Code:
$street = new Street();
$street->get_by_id(1); // here is problem
i get fatal error: HTTP error 500 (Internal Server Error)

if i access function directly with url, then everything works like it should.


HMVC Modules - El Forum - 05-01-2012

[eluser]Ordos[/eluser]
@bralens, what does the actual error say?


HMVC Modules - El Forum - 05-01-2012

[eluser]bralens[/eluser]
I made screenshoot


HMVC Modules - El Forum - 05-01-2012

[eluser]Ordos[/eluser]
@bralens turn on error reporting or check your apache log for the actual error message and line please Smile


HMVC Modules - El Forum - 06-20-2012

[eluser]macigniter[/eluser]
This looks awesome. But does it play well with Sparks?


HMVC Modules - El Forum - 12-14-2012

[eluser]katanama[/eluser]
Jens,

Nice work... It's simple and clean... loving it.

Debugging is as easy as using vanilla Codeigniter, Not as much jumping from file to file and variables are visible in debugger window too (or var_dump( )). I uninstalled the one from wiredesignz, replaced it with yours.






HMVC Modules - El Forum - 12-14-2012

[eluser]InsiteFX[/eluser]
Have you tested this using the CodeIgniter Form_Validation Class?



HMVC Modules - El Forum - 12-14-2012

[eluser]katanama[/eluser]
[quote author="InsiteFX" date="1355540292"]Have you tested this using the CodeIgniter Form_Validation Class?
[/quote]

So far doesn't give any problem but it has been only a day since I install.

Methods in Form_Validation.php that I'm using :

$this->form_validation->set_rules()
$this->form_validation->run()
validation_errors()
form_error()
set_value()




The only thing that doesn't work for me is that it does not have class autoloader (spl_autoload).

All my controller extends either Public_controller or Admin_Controller, which then extend MY_Controller that extends CI_controller.

The system knows how to find MY_Controller, CI_Controller and Foo_Controller.... but not Public/Admin controller...

With Wiredesignz HMVC, Modules::Autoload knows to search automatically in Core, Library, and third_party folder.

But solved it by including the two, Public and Admin controller, manually at the top of MY_Controller file.


HMVC Modules - El Forum - 12-14-2012

[eluser]InsiteFX[/eluser]
You can use this one:
Code:
/*
| -------------------------------------------------------------------------
| Native spl_autoload_register() - by Kenneth Vogt
| -------------------------------------------------------------------------
|
| Here is an updated version of Phil Sturgeon’s code:
|
| Thanks to Phil Sturgeon and Kenneth Vogt.
|
| NOTE:
| Requires PHP 5.3.+
| -------------------------------------------------------------------------
| MODIFIED by InsiteFX
| As of CI 3.0 Dev - The constant EXT has been removed modified
| to use '.php' now instead of EXT.
| should work for all version of CI and PHP 5.3
| -------------------------------------------------------------------------
| Place at the bottom of your ./application/config/config.php file.
| -------------------------------------------------------------------------
*/
spl_autoload_register(function($class)
{
if (strpos($class, 'CI_') !== 0)
{
  if (file_exists($file = APPPATH . 'core/' . $class . '.php'))
  {
   include $file;
  }
  elseif (file_exists($file = APPPATH . 'libraries/' . $class . '.php'))
  {
   include $file;
  }
}
});

./application/core/
Code:
MY_Controller.php
Admin_Controller.php
Public_Controller.php