$this->load->model('module/controller'); $this->load->module('module/controller');
But with DX_auth there would be a problem as it also need to have the libraries and config file to be loaded. For that purpose we will use a autoload file under config folder in our module. HMVC now autoloads a variable name $autoload. We can call it in the construct funtion, but then it will be called only once. The autoload file under config folder of auth module would be like this:
$autoload['libraries'] = array('DX_Auth_Event'); /* | ------------------------------------------------------------------- | Auto-load Helper Files | ------------------------------------------------------------------- | Prototype: | | $autoload['helper'] = array('url', 'file'); */ $autoload['helper'] = array('url','form'); /* | ------------------------------------------------------------------- | Auto-load Plugins | ------------------------------------------------------------------- | Prototype: | | $autoload['plugin'] = array('captcha', 'js_calendar'); */ $autoload['plugin'] = array(); /* | ------------------------------------------------------------------- | Auto-load Config files | ------------------------------------------------------------------- | Prototype: | | $autoload['config'] = array('config1', 'config2'); | | NOTE: This item is intended for use ONLY if you have created custom | config files. Otherwise, leave it blank. | */ $autoload['config'] = array('dx_auth'); /* | ------------------------------------------------------------------- | Auto-load Language files | ------------------------------------------------------------------- | Prototype: | | $autoload['language'] = array('lang1', 'lang2'); | | NOTE: Do not include the "_lang" part of your file. For example | "codeigniter_lang.php" would be referenced as array('codeigniter'); | */ $autoload['language'] = array(); /* | ------------------------------------------------------------------- | Auto-load Models | ------------------------------------------------------------------- | Prototype: | | $autoload['model'] = array('model1', 'model2'); | */ $autoload['model'] = array();And now we will create our necessary function within the auth controller or what ever controller you want to write in. suppose we write the following function:
function is_logged_in() { $this->load->library('DX_Auth'); // Set auth info if($this->dx_auth->is_logged_in()) { $this->userId = $this->dx_auth->get_user_id(); $this->_data['userId'] = $this->userId; } }Now we will call this function from our main root controller folder, like this :
$this->load->module('auth'); $this->auth->is_logged_in();
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
List of my works:
Technical Support:
If you still face the technical problem, please get support of our highly skilled technical team: garazlab.com.
Wordpress Plugins:
If you still face the technical problem, please get support of our highly skilled technical team: garazlab.com.
Wordpress Plugins:
- Real-Time Health Data from Every Where:WP plugin to display real-time health data & increase sale by promoting user specific products according to health information: garazlab.com.
- Woocommerce Stock Notification Builder:Sends desktop, mobile & email notifications with full customization.Build your own product notification system with it: garazlab.com.
Opencart Extensions:
- Product Based Quantity Wise Shipping: Find it here.
- OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
- Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
- Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
- Custom Field Product - add unlimited custom fields to the product form: Find it here.
- Formcaptcha - add captcha on the register page: Find it here.
4 comments:
I shouldn't go on reading after
---
$this->load->model('module/controller')
---
Sorry, in the current state articles makes very little sense. You seem to describe a distinct situation that happened in your code, but neither give a good description, nor make an understandable generalization.
Complete listings of modules would help, I suppose.
What I have told in my post is that how we can cross load our modules with each component of it in hmvc. I have added the config file here also. and there is every description of the problem and how it could be fixed.
what is H meaning in HMVC?
Earli.us
H means hierarchical.
Post a Comment