A question about list_items in the simple model tutorial

edited May 2012 in Modules
Hello,

I am trying to follow the tutorial for creating a simple module.

I don't understand everything in the function list_items.

In the line: $data = parent::list_items($limit, $offset, $col, $order)
What does parent::list_items($limit, $offset, $col, $order) do?

And what does this comment mean: "Although we show default $col and $order values, those need to be set on the module to properly sort the list items."

As far as I understand the default $col is 'name' and the default $order is 'asc' so where do we set them on the module?
what?

Thank you

Comments

  • edited 5:54PM
    You can specify them in your MY_fuel_modules.php file for the particular module you are creating. As an example, look at the fuel/modules/fuel/config/fuel_modules.php
    'default_col' => 'location', 'default_order' => 'asc',
  • edited 5:54PM
    Thank you again :)
  • edited 5:54PM
    Sorry, I'm still not sure about something here.

    I have downloaded the example files and looking at the My_fuel_modules file
    I don't see that the default_col and default_order are set.
    The file has only these lines:

    $config['modules']['authors'] = array();
    $config['modules']['articles'] = array();
    $config['modules']['categories'] = array();

    So does that mean the module won't sort the items properly? Quote: "those need to be set on the module to properly sort the list items."
  • edited 5:54PM
    When the modules are set like that they use the default values.

    The default values can be seen here: http://www.getfuelcms.com/user_guide/modules/simple

    You'll see the default_col defaults to:

    The default is the second column of the table (e.g. the one normally after the id column)
  • edited 5:54PM
    Ah ! Now I understand. Thank you :)
Sign In or Register to comment.