Welcome Guest, Not a member yet? Register   Sign In
HMVC
#2

[eluser]Tim Brownlaw[/eluser]
if you have a module called "users" with the following structure

modules
users
controllers
users.php
admin.php
models
mdl_users.php

To load the model mdl_users from the users module, try using the <module name>/<model filename>,
ie $this->load->model('users/mdl_users');

To load the users controller you can use
$this->load->module('users/users');
But since the controller has the same name as the module you can shorten it to just.
$this->load->module('users');

To load the admin module you would use
$this->load->module('users/admin');


What I do, If I want to access a Model from another module, is create a method inside the modules controller to perform the call.
So All external access is done through a controller call.
Which means I only need to load the module like $this->load->module('funky_stuff") and use this $this->funky_stuff-><method_name> and never have to know about any underlying models etc.


Messages In This Thread
HMVC - by El Forum - 07-23-2014, 12:15 AM
HMVC - by El Forum - 07-23-2014, 12:47 AM
HMVC - by El Forum - 07-23-2014, 04:39 AM
HMVC - by El Forum - 07-23-2014, 05:02 AM
HMVC - by El Forum - 07-23-2014, 05:43 AM
HMVC - by El Forum - 07-24-2014, 12:26 AM
HMVC - by El Forum - 07-24-2014, 04:57 AM
HMVC - by El Forum - 07-28-2014, 01:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB