<?php 

class products extends CI_Controller {

function products()	 

{  

parent::__construct();	

$this->load->library('session');

$this->load->Model('functions', 'fun');  //function in model 

$this->load->library('pagination');

	 $this->load->library('form_validation');

 

} 







	public function index($lang='')

	{           	$config['base_url'] = base_url().'products/index/';

		$config['total_rows'] = $this->fun->get_num('products');

		$config['per_page'] = 15;

		$config['num_links'] = 3; 

		$config['uri_segment'] = 3;	

		$config['full_tag_open']='<div class="paginations"><ul>';

		$config['full_tag_close'] = '</ul></div>';

		$config['next_link'] = 'Next';

		$config['prev_link'] = 'Prev';

		$config['next_tag_open'] = '<li class="latest_img">';

		$config['next_tag_close'] = '</li>';
		
			$config['first_tag_open'] = '<li class="latest_img">';

		$config['first_tag_close'] = '</li>';
	$config['last_tag_open'] = '<li class="latest_img">';

		$config['last_tag_close'] = '</li>';


		$config['prev_tag_open'] = '<li class="latest_img">';

		$config['prev_tag_close'] = '</li>';

		$config['num_tag_open'] = '<li class="latest_img">';

		$config['num_tag_close'] = '</li>';

		$config['cur_tag_open'] = '<li class="current latest_img"><a href="#" class="current">';

		$config['cur_tag_close'] = '</a></li>';		

		$offset = $this->uri->segment(3,0);

		$this->session->set_userdata('offset',$offset);

		$this->pagination->initialize($config);

		$q= $this->fun->getall_pag('posts','products',$config['per_page'],$config['uri_segment']);

		$data['posts']=$q;



 

	         if($this->session->userdata('lang')=='ar')
	    {

                $this->load->view('header_ar');
				$this->load->view('products_ar',$data);
				$this->load->view('footer_ar');
	   }else
	   {
	            $this->load->view('header');
				$this->load->view('products',$data);
				$this->load->view('footer');


	   }


		

	}
		public function details($name,$id)

	{           
	            $data['id']=$id;
	            $this->load->view('header_ar',$data);
				$this->load->view('services_details_ar',$data);
				$this->load->view('footer_ar');



		

	}

	
	}
