File ROUTE (/application/bootstrap.php)
Route::set('list', 'list(/
->defaults(array(
'directory' => 'frontend',
'controller' => 'company',
'action' => 'list',
));
File CONTROLLER (/application/classes/controller/frontend/company.php)
public function action_list(){
$slug = $this->request->param('slug');
$page = $this->request->param('page');
if($page==""){ $page = 1; }
$rs_category = ORM::factory('company_category', array('slug' => $slug));
$total = $rs_category->lsCompany->count_all();
$items_per_page = 30;
$off = ($page-1)*$items_per_page + ($page-1);
$ls_company = $rs_category->lsCompany->offset($off)->limit($items_per_page)->find_all();
$view = View::factory('frontend/company/list');
$view->set("ls_company", $ls_company);
$view->set("total", $total);
$view->set("items_per_page", $items_per_page);
$view->set("route_slug", "list/".$slug);
$this->template->set('content', $view);
}
File VIEW (/application/views/frontend/company/list.php)