Module-View page not found


I created a simple module called: products.

After I create a product with a slug, when I click on the View button, it tries to go to: mysite/products/slug but I get page not found.

What am I missing?


  • A simple module will have a controller called "products". That URL is pointing to a function in your controller called "slug". What is the URL behind the view button?

  • Thank you for answering me. I don't have a controller for this module (From the documentation: Simple modules don't require additional views and controllers to be created), it is a simple module. The url behind the button is: mysite/products/slug (the product's slug), so if the product's slug is: xxx it will be mysite/products/xxx

  • @Sigal - do you mean the "View" button from the Fuel backend listing?

    What's the content of your MY_fuel_modules.php file look like?

    Is it something like that?

    $config['modules']['news'] = array(
        'module_name'    => 'Products',
        'module_uri'     => 'products',
        'model_name'     => 'Product_model',
        'preview_path'   => 'products/{slug}',
        // frontend pages
        // @link => Generate Post Pages
        'pages' => array(
            'base_uri' => 'products',
            'per_page' => 10,

    For the preview_path, you need to set the {placeholder} of the field (most of the time, it is slug)

    And to use the generated post pages as described here: => Generate Post Pages you need to setup the pages config array. Unfortunately, it's not really straight forward in the docs, because it assumes too much.

    here is what I got working without setting up any new views or controller:

    I assume your Products_model is extending the Base_posts_model like this (Replace all "Tests" with "Products", also keep in mind, Base_posts_model assumes fields like publish_date etc.

    class Tests_model extends Base_posts_model { // Fuel Way
        public $foreign_keys  = array(
            'category_id' => array(
                FUEL_FOLDER => 'fuel_categories_model',
        function __construct()
        function list_items($limit = NULL, $offset = NULL, $col = 'name', $order = 'asc', $just_count = FALSE)
            $this->db->select(', tests.title, tests.dec');
            $data = parent::list_items($limit, $offset, $col, $order, $just_count);
            return $data;
    // don't forget this, else a lot of things won't work
    class Tests_item_model extends Base_post_item_model {

    and this is the module config: take a look at the pages key:

    $config['modules']['tests'] = array(
        'module_name'    => 'Test',
        'module_uri'     => 'tests',
        'model_name'     => 'Tests_model',
        'limit_options'  => array( '25' => '25'),
        'display_only'   => false,
        'model_location' => 'app',
        'display_field'  => 'title',
        'search_field'   => 'title',
        'default_col'    => 'title',
        'table_headers'  => [
            'id'    => 'ID', 
            'title' => 'Title',
        'permission'     => 'tests',
        // frontend pages
        // @link => Generate Post Pages
        'pages' => array(
            'base_uri' => 'tests',
            'per_page' => 10,
            // fuel\modules\fuel\libraries\Fuel_posts.php:203
            // function routes() thast is used to generate routes for generic pages
            #'archive'  => $base_uri.'/archive(/$year:\d{4})(/$month:\d{1,2})?(/$day:\d{1,2})?',
            #'tag'      => $base_uri.'/tag/($tag:.+)',
            #'category' => $base_uri.'/category/($category:.+)',
            #'search'   => $base_uri.'/search(/$q:.+)?',
            #'list'     => $base_uri,
            #'post'     => $base_uri.'/(\d{4})/(\d{2})/(\d{2})/($slug:.+)',
            #'slug'     => $base_uri.'/($slug:.+)'
            'category' => [
                'view'  => '_posts/category',
                'route' => 'products/category/($category:.+)',
                'empty_data_show_404' => TRUE
            // _posts/ refers to /views/_posts/* folder
            'list' => '_posts/posts',
            'slug' => [
                'view'  => '_posts/post',
                'route' => 'products(/$slug:.+)'

    I haven't figured it out completely, but that's what I came up with reading the docs ( and jumping through the code with the debugger.

    If I got something wrong, please correct me.

Sign In or Register to comment.