People, how to specify your group of settings (not default). Kohana 3.2.

Here is what a piece of code with pagination looks like.

$count = ORM::factory('product')->count_all(); $pagination = Pagination::factory(array( 'total_items' => $count, )); //Вывод из БД записей $products = ORM::factory('product') ->limit($pagination->items_per_page) ->order_by('id', 'desc') ->offset($pagination->offset) ->find_all(); 

This is what the config file looks like.

 return array( // Application defaults 'default' => array( 'current_page' => array('source' => 'route', 'key' => 'page'), // source: "query_string" or "route" 'total_items' => 0, 'items_per_page' => 10, 'view' => 'pagination/floating', 'auto_hide' => TRUE, 'first_page_in_url' => FALSE, 'uri_segment' => 'page' ), 'admin' => array( 'current_page' => array('source' => 'route', 'key' => 'page'), // source: "query_string" or "route" 'total_items' => 0, 'items_per_page' => 50, 'view' => 'pagination/floating', 'auto_hide' => TRUE, 'first_page_in_url' => FALSE, 'uri_segment' => 'page' ), ); 
  • Settings group for what? What is the component for? - VasyOk
  • For pagination - Demyan112rv

1 answer 1

I'm not sure - I write by what I saw in the module code, but it should be something like this:

 $pagination = Pagination::factory(array( 'total_items' => $count, )); $pagination->setup(array('group' => 'default')); 

And instead of 'default' put your key from configs.

  • Thank you very much) I tried Pagination :: setup ('group' => 'admin') - without result) I was close))) - Demyan112rv