Navigation

User login

Who's new

  • ferry
  • dionaris
  • prima
  • trackrecord
  • adhey
Home | Conversions

Conversions

Previous Next
Pagination (convert to)
Codeigniter , by admin
	public function product_list($catid){
			$this->load->library('pagination'); //call pagination library
			$this->db->select('*')->from('prima_products')->where('catid',$catid);
			$num = $this->db->count_all_results();
				if($num>0){
					$config['base_url'] = base_url().'index.php/order/view/'.$order_id.'/'; //set the base url for pagination
					$config['total_rows'] = $num; //total rows
					$config['per_page'] = 100; //the number of per page for pagination
					$config['uri_segment'] = 4; //see from base_url. 3 for this case
					$config['full_tag_open'] = '<p>';
					$config['full_tag_close'] = '</p>';
					$this->pagination->initialize($config); //initialize pagination
						$this->db->select('*')->from('prima_products')->where('catid',$catid);
						$getData = $this->db->get('', $config['per_page'],$this->uri->segment(4));
						if($this->db->count_all_results() > 0){
							$detail = $getData->result_array();
							$h = '';
							foreach($detail as $rows) {
								$h .= '<div style="margin:5px;float:left;height:200px;width:110px;border: 1px solid brown">
								<div style="text-align:center">'.anchor('product/view/'.$rows['product_id'], $rows['product_name'], 'title="'.$rows['product_name'].'"').'</div>
								<div style="height:120px;text-align:center">';
								if($rows['picture']){
									$info = pathinfo($rows['picture']);
									$h .= anchor('product/view/'.$rows['product_id'],'<img src="'.base_url().'/'.str_replace($info['filename'],$info['filename'].'_thumb',$rows['picture']).'">');
								}
								$h .= '</div>
								<div style="text-align:center;margin-bottom:0px">Add to cart</div>
								</div>';
							}
							return $h;
						}else{
							$detail = null;	
						}
					return $data;	
				}else{
					return 'No product found';
				}
	}

Who's online

There is currently 1 user and 1 guest online.

Online users

  • admin