Advanced Module Custom Controller?

edited February 2014 in Modules
I already have a module for users that is working, however I'm trying to add an 'approval queue' and I've encountered something i don't particularly understand.

I have module "user" within that is a user controller "user.php", which handles login,registration etc. Then I have the model "user_main_model.php" which handles showing the users in the back end using the nice table view.

However now I want to create /admin/user/queue and I have no idea how to take over this URI. I'd prefer it to have a different controller to the user one so I created controller "admin.php".

<?php
require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php');
class Admin extends Fuel_base_controller{
function __construct()
{
parent::__construct();
//$this->load->model('user_main_model');
die("Success");
}
}
?>

However this never gets me a "success" I just get rendered a blank page.

I haven't added the user_queue to /config/user_fuel_modules.php as it seems that requires me to link it up to a module and use that default table view which I don't want. I want to be able to customize this controller/view.

My /config/user_routes.php file:

<?php
$user_controllers = array('main', 'admin');
foreach($user_controllers as $c)
{
$route[FUEL_ROUTE.'user/'.$c] = FUEL_FOLDER.'/module';
$route[FUEL_ROUTE.'user/'.$c.'/(.*)'] = FUEL_FOLDER.'/module/$1';
}
$route[FUEL_ROUTE.'user/settings'] = USER_FOLDER.'/settings';
?>

So yeah I'm pretty confused, please let me know how to go about this! :)

Comments

  • edited 2:35PM
    And obviously there isn't any < br / >'s in my code, this editor seems to add them.
  • edited 2:35PM
    I think in this case, since you are not using the "module" controller (for a simple module with the table list view that you click to the edit screen), you'll need a different route. Something like the following:
    <?php $user_controllers = array('main'); foreach($user_controllers as $c) { $route[FUEL_ROUTE.'user/'.$c] = FUEL_FOLDER.'/module'; $route[FUEL_ROUTE.'user/'.$c.'/(.*)'] = FUEL_FOLDER.'/module/$1'; } $route[FUEL_ROUTE.'user/settings'] = USER_FOLDER.'/settings'; $route[FUEL_ROUTE.'user/admin'] = USER_FOLDER.'/admin'; ?>
  • edited 2:35PM
    Perfect thanks very much :)
Sign In or Register to comment.