Simple Module List Actions 404


I am working on a simple module for a dictionary, and in addition to the "Create" button that comes with the simple module, I want to add an 'list_actions' button to bring the user to a custom page where they can upload a file that will be parsed and inserted into the dictionary database. So far I have set up the module like this in MY_fuel_modules.php:

$config['modules']['dictionary'] = array(
    'module_name' => 'SLP Dictionary', 
    'permissions' => 'dictionary', 
    'display_field' => 'headword', 
    'table_headers' => array( 
        'id' => 'Entry #', 
        'headword' => 'Headword', 
        'gloss_en' => 'English', 
        'gloss_nep' => 'Nepali', 
        'theme' => 'Theme'
    'icon_class' => 'ico_logs', 
    'archivable' => TRUE, 
    'list_actions' => array(
        'dictionary/upload' => 'Bulk Upload SFM'  
    'pages' => array( 
        'base_uri' => 'dictionary', 
        'list' => 'dictionary/all', 
        'post' => 'dictionary/entry', 

A button is generated at the top which says "Bulk Upload SFM." However, when I click it, it takes me to http://.../fuel/dictionary/upload and this page generates a 404. How can I add a route to this page and select the admin view for it?

Should I make the bulk uploader a separate simple module?



  • You'll need to setup a normal CI Controller to handle that route. FUEL does this as well for certain modules like the Pages module that has additional routes. It has a Page controller (fuel/modules/fuel/controllers/Pages) which extends the Module Controller. Just make sure that the controller inherits from the Fuel_base_controller (like the Module Controller and thus Pages controller does).

  • Thanks for your response! To clarify, I want to add the "Bulk Upload SFM" page/view to the admin backend, not to the frontend of the module. Does a normal CI controller still work for that purpose?

    So now I have the simple module Dictionary, which lists all the dictionary entries, and has a "Create" button by default. I want the "Bulk Upload" button to show up next to "Create" as a list_action, and when that button is clicked, I was imagining that it would take the admin user on the backend to a bulk uploader that is part of the Dictionary module.

    I added a Dictionary CI controller but then it overrode the layouts and views that I had already set up in the _variables/dictionary.php file.

  • The controller should inherit the Module controller or Fuel_base_controller so that it is checking the logged in session. You should also create a route in the routes file to map to that controller path to be something like'my_module_controller/upload' => 'fuel/my_module/upload'.

    To get it to render within an admin template, you can call the Fuel_admin::render() method like so:

    $this->fuel->admin->render('my/path/to/view', $vars, '', 'app');

    The first parameter is the path to the view file.

    The second parameter are the variables you want to pass to the page.

    The third parameter is the 'mode' which can be one of the following values:


    The last parameter 'app' refers to the advanced module to look in. In this case, it sounds like you have your view file in the main fuel/appliation/views/ directory so we use the 'app' module to make sure it looks in that folder.

    A good example to look at may be the fuel/modules/fuel/controllers/Navigation.php file.

  • edited May 2020

    Thanks for all of your insight and for pointing me in the right direction. I thought I was going to have to make an advanced module for this, but got it to work as a simple module as I had hoped. For future reference of others, I followed your instructions but modified them slightly to get it to work. For the custom bulk uploader to work on the admin, I added this route to application/config/routes.php:

    $route[FUEL_ROUTE.'dictionary/upload'] = 'dictionary/upload';

    This got rid of my 404. Then I added a controller as suggested to application/controllers/Dictionary.php which had the following structure:

    if (!defined('BASEPATH')) exit('No direct script access allowed');
    class Dictionary extends Fuel_base_controller {
        public function __construct()
        public function upload()

    For the upload() method in the controller, I based my code off of the Navigation controller as recommended.

    Thanks so much!

Sign In or Register to comment.