Example #1
0
 public function index()
 {
     //set the title of the page
     $this->template->title(lang('web_list_product'));
     //set the pagination configuration array and initialize the pagination
     $config = $this->set_paginate_options('index');
     //Initialize the pagination class
     $this->pagination->initialize($config);
     //control of number page
     $page = $this->uri->segment(3) ? $this->uri->segment(3) : 1;
     $this->template->set('parent_category', "");
     //find all the categories with paginate and save it in array to past to the view
     $this->template->set("products", Product::paginate_all($config["per_page"], $page));
     //create paginateĀ“s links
     $this->template->set("links", $this->pagination->create_links());
     //control variables
     $this->template->set('page', $page);
     $this->template->set('category_id', NULL);
     //load the view
     $this->template->build('products/list');
 }