Filters

How can I put a dropdown on top of the page to filter a list? For example, filter articles by authors?
Thank you!

Comments

  • edited 9:34AM
    Im using simple models...
  • edited 9:34AM
    The navigation module may be a good one to look at. The module has the 'filter' parameter set on at fuel/modules/fuel/config/fuel_modules.php which takes an array of parameters similar to what you would use for form_builder. The options for the select are actually set in the fuel/modules/fuel/controllers/navigation.php file in the list_items method however, they could be set within the fuel_modules file as well.
  • edited 9:34AM
    I created a controller inside controllers/ with this:

    <?php

    class Questions extends CI_Controller {

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

    function items(){
    $this->load->model('Areas_model');
    $this->filters['area_id']['options'] = $this->Areas_model->options_list('id', 'name', array(), false);
    parent::items();
    }

    }

    ?>

    But it doesn't work :(
    It's obvious im doing something wrong here...
    Any thoughts?
  • edited 9:34AM
    You'll want to extend the Module controller.
  • edited 9:34AM
    you mean Base_module_controller?
  • edited 9:34AM
    ive replaced Base_module_controller with CI_Controller, doesnt work either
  • edited 9:34AM
    The fuel/modules/fuel/controllers/navigation.php file should have at the top the following:

    require_once('module.php'); class Navigation extends Module {
    In your case the require_once will probably need a different path to point to the module.php file since your model will exist somewhere else. Does that make sense?
Sign In or Register to comment.