0

This is my first hmvc attempt and it's going wrong... I'm trying to separate my site zones through different modules. My intention then is control the access using ion_auth for hmvc. Thats my initial structure:

/application
  /modules     <-- hmvc
    /public_zone
       /controller
        public_zone.php
       /view
        ...
    /private_zone
     ...

So, to do this (being installed hmvc on core and third_party folders) I tried to setup as 'default_controller' the 'public_zone' controller. His mission is load the root page ('localhost'), but *it returns a 404 error.*

This is my public_zone.php file:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Public_zone extends MX_Controller {

   public function index()
    {
      $this->load->view('include/header');
      $this->load->view('frontpage');
      $this->load->view('include/footer');
    }

}

Maybe the problem is on routes.php (application/config/routes.php) file? I'll tried this:

$route['default_controller'] = "public_zone"; 
$route['404_override'] = '';

Anyone can tell me what Im doing wrong? For sure I misunderstood some hmvc concept... But the fact is I don't know why it doesn't works :(

Dr. Dan
  • 2,288
  • 16
  • 19
Courier
  • 63
  • 1
  • 10

1 Answers1

1

First, it's important that you leave the CI structure intact. So you need the structure:

/application
    /controllers
        public_zone.php
    /views
        frontpage.php
        /include
           header.php
           footer.php
    /models

Ofcourse, you need also the other folders that comes with CI.

Second, you need some changes in the controller in order to make it work.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Public_zone extends CI_Controller {

 public function __construct()
 {
   parent::__construct();
 }

 public function index()
 {
   $this->load->view('include/header');
   $this->load->view('frontpage');
   $this->load->view('include/footer');
 }

}

After this changes it's supposed to work :) Be also sure to read the user guide: http://codeigniter.com/user_guide/

It might cost you some time to read, but later it will save you a lot of time.

Good luck!

f4der
  • 711
  • 4
  • 18