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 6:54AM
    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 6:54AM
    Thank you again :)
  • edited 6:54AM
    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 6:54AM
    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 6:54AM
    Ah ! Now I understand. Thank you :)
Sign In or Register to comment.