Sterling Duchess Sterling Duchess - 1 month ago 8x
PHP Question

CodeIgniter HMVC Arhitecture 404 Error

I have CodeIgniter 2.1.3 extended with following HMVC here plugin i followed it to the end and got it to work with no problems with the basic example. However now i would like to extend my application with BitAuth authentication libary and i would like to implement it as a module.

So i have done all the steps according to documentation for the plugin:

I have created a folder auth with controllers and view that comes with BithAuth libary and called the module controller and method yet this gives me a 404 error.

I noticed one diffirence between the test module and my bithauth module for instance when i call

<?php Modules::run('module/controller/method'); ?>

this on the test module and then visit localhost/home/index the page shows home page view and renders the view of module. However when i call this on my bitauth module and i visit
i get redirected to
and that throws a 404 error.

My folder structure:


My home controller that maps to home url: localhost

class Home extends MX_Controller {
public function index()

and its view file:

<title>Shop: index</title>
<?php Modules::run('auth/Example/index'); ?>

Now in the auth folder i have bithauth controller:

class Example extends MX_Controller

* Example::__construct()
public function __construct()



$this->form_validation->set_error_delimiters('<div class="error">', '</div>');

public function index()
if( ! $this->bitauth->logged_in())
$this->session->set_userdata('redir', current_url());

$this->load->view('example/users', array('bitauth' => $this->bitauth, 'users' => $this->bitauth->get_users()));


And the view in auth/views: a simple form


echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Users</caption>';
echo '<tr><th width="1">ID</th><th>Username</th><th>Full Name</th><th>Actions</th></tr>';
if( ! empty($users))
foreach($users as $_user)
$actions = '';
$actions = anchor('example/edit_user/'.$_user->user_id, 'Edit User');
if( ! $_user->active)
$actions .= '<br/>'.anchor('example/activate/'.$_user->activation_code, 'Activate User');


echo '<tr>'.
echo '</table>';

echo '<div id="bottom">';
echo anchor('example/logout', 'Logout', 'style="float: right;"');
echo anchor('example/groups', 'View Groups');
echo '<br/>'.anchor('example/add_user', 'Add User');
echo '</div>';


I noticed that redirect was happening due to
statement in
method i solved that now however i dont get the view of my module displayed and i dont get any errors.


i dont get the view of my module displayed and i dont get any errors.

try this:

<?php echo Modules::run('module/controller/method'); ?>

but better to use this way (Codeigniter Output class) :

<?php $this->output->append_output( Modules::run('module/controller/method') ); ?>

i hope this helps