diff --git a/README.md b/README.md index 5dfc4b1..6dc863a 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,23 @@ # CodeIgniter HMVC -### Support development of Modular Extensions - HMVC +### Support development of Modular Extensions - HMVC to WireDesignz [![Support development](https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FK79XNCUE9P5C) # Modular Extensions - HMVC -Modular Extensions makes the CodeIgniter PHP framework modular. Modules are groups of independent components, typically model, controller and view, arranged in an application modules sub-directory that can be dropped into other CodeIgniter applications. +**Modular Extensions** makes the CodeIgniter PHP framework modular. Modules are groups of independent components, typically model, controller and view, arranged in an application modules sub-directory that can be dropped into other CodeIgniter applications. -HMVC stands for Hierarchical Model View Controller. +**HMVC** stands for **Hierarchical Model View Controller**. Module Controllers can be used as normal Controllers or HMVC Controllers and they can be used as widgets to help you build view partials. +Design by **wiredesignz**, thank you verymuch! + ### Features: All controllers can contain an autoload class variable, which holds an array of items to load prior to running the constructor. This can be used together with module/config/autoload.php, however using the $autoload variable only works for that specific controller. -``` +```php '../modules/', @@ -39,13 +41,13 @@ Modules::run() output is buffered, so any data returned or output directly from Controllers can be loaded as class variables of other controllers using -``` +```php $this->load->module('module/controller'); ``` or simply -``` +```php $this->load->module('module'); ``` @@ -53,8 +55,8 @@ $this->load->module('module'); Any loaded module controller can then be used like a library, ie: -``` - $this->controller->method() +```php + $this->controller->method(); ``` , but it has access to its own models and libraries independently from the caller. @@ -63,7 +65,9 @@ All module controllers are accessible from the URL via module/controller/method ### Use: -create file application/core/MY_Loader.php with content +I am custom library, now config same rule below + +create file ***application/core/MY_Loader.php*** with content ```php load->model('module/model'); ``` Modules::run() is designed for returning view partials, and it will return buffered output (a view) from a controller. The syntax for using modules::run is a URI style segmented string and unlimited variables. -``` +```php load->module() +```php +$this->load->module(); ``` or -``` -Modules::load() +```php +Modules::load(); ``` and PHP5 method chaining is available for any object loaded by MX. ie: -``` -$this->load->library(‘validation’)->run() +```php +$this->load->library(‘validation’)->run(); ``` To load languages for modules it is recommended to use the Loader method which will pass the active module name to the Lang instance; ie: -``` +```php $this->load->language('language_file'); ``` @@ -179,8 +183,8 @@ The PHP5 spl_autoload feature allows you to freely extend your controllers, mode The library loader has also been updated to accommodate some CI 1.7 features: ie Library aliases are accepted in the same fashion as model aliases, and loading config files from the module config directory as library parameters (re: form_validation.php) have beed added. -``` -$config = $this->load->config(‘config_file’) +```php +$config = $this->load->config(‘config_file’); ``` , Returns the loaded config array to your variable. @@ -189,7 +193,7 @@ Models and libraries can also be loaded from sub-directories in their respective When using form validation with MX you will need to extend the CI_Form_validation class as shown below, -``` +```php ```