Welcome Guest, Not a member yet? Register   Sign In
Problem setting HMVC
#1

(This post was last modified: 04-10-2015, 09:22 AM by Lykos22.)

Hi I'd like some help please.

I 'm trying to set up modularity on my CI 3 installation, but seems not working. I'm using wiredesignz package found here under the "Branches" tab.

The steps I did:

1. Copied MY_Loader & MY_Router in application/core
2. Copied MX folder in application/third_party
3. Copied this line of code in application/development/config.php ( I have moved config.php under development folder )

PHP Code:
// set location for modules
$config['modules_locations'] = array(
    
APPPATH.'modules/' => '../../modules/',
); 


4. Created
Code:
application
- modules
-- controllers
--- Test.php
-- models
-- views
--- test.php

with my Test.php like this

PHP Code:
class Test extends CI_Controller {
    
    function 
__construct() {
        
parent::__construct();
    }

    public function 
index() {
        
$this->load->view('test');
    }


just to check that is working ok, but when I hit on my browser
Code:
localhost/myapp/test
, I get a 404 error.

Any ideas what I'm doing wrong?
Reply
#2

modules/test/controllers/test.php
modules/test/models/
modules/test/views/view.php
Reply
#3

(This post was last modified: 04-10-2015, 09:05 PM by wolfgang1983.)

(04-10-2015, 09:11 AM)Lykos22 Wrote: Hi I'd like some help please.

I 'm trying to set up modularity on my CI 3 installation, but seems not working. I'm using wiredesignz package found here under the "Branches" tab.

The steps I did:

1. Copied MY_Loader & MY_Router in application/core
2. Copied MX folder in application/third_party
3. Copied this line of code in application/development/config.php ( I have moved config.php under development folder )


PHP Code:
// set location for modules
$config['modules_locations'] = array(
 
   APPPATH.'modules/' => '../../modules/',
); 

4. Created


Code:
application
- modules
-- controllers
--- Test.php
-- models
-- views
--- test.php

with my Test.php like this


PHP Code:
class Test extends CI_Controller {
    
    function 
__construct() {
        
parent::__construct();
    }

    public function 
index() {
        
$this->load->view('test');
    }


just to check that is working ok, but when I hit on my browser  





Code:
localhost/myapp/test
, I get a 404 error.

Any ideas what I'm doing wrong?

You still have the CI_Controller Where Should Be MX_Controller you must have also module in side modules folder also


PHP Code:
<?php
class Xyz extends MX_Controller 
{
 
   function __construct()
 
   {
 
       parent::__construct();
 
   }


Module Path


Code:
application => modules
application => modules => yourmodule
application => modules => yourmodule => controllers
application => modules => yourmodule => controllers > Test.php
application => modules => yourmodule => models
application => modules => yourmodule => views
application => modules => yourmodule => views => test.php

Configure your routes


PHP Code:
$route['module_name'] = 'modulename/controller_name/function'


Config.php

Use this


PHP Code:
$config['modules_locations'] = array(

 
   APPPATH.'modules/' => '../modules/',
); 

Instead of

PHP Code:
$config['modules_locations'] = array(

 
   APPPATH.'modules/' => '../../modules/',
); 

If that does not work then think its to do with your htaccess
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#4
Tongue 

Yes you were both right, I forgot to put the controllers, the models and views folders inside the module folder. Silly mistake from my part Tongue

Thanks a lot guys for the help, now its working!!! Smile
Reply
#5

(04-11-2015, 01:38 AM)Lykos22 Wrote: Yes you were both right, I forgot to put the controllers, the models and views folders inside the module folder. Silly mistake from my part  Tongue

Thanks a lot guys for the help, now its working!!! Smile

just tested this. no need to add in the code

Code:
$config['modules_locations'] = array(

   APPPATH.'modules/' => '../modules/',
);
Reply




Theme © iAndrew 2016 - Forum software by © MyBB