[eluser]tashigiri[/eluser]
Dear all CI forum members..
im a newbie and just learn php also CI..
i asked to create page like this :
image
And here is my code @ controller
Code:
function index($start = 0 , $limit = 5 , $uri_segment = 2)
{
$sql = "SELECT ads.id,ads.job_title,ads.reference,ads.ads_type,ads.timestamp_start,ads.timestamp_end, count(ja.id) AS application ,ja.apply_status
FROM adv_standart AS ads LEFT JOIN job_apply AS ja ON ads.id = ja.ads_id
WHERE ads.company_id = '". $this->session->userdata('company_id') ."' AND ads.delete_status = 'f'
AND timestamp_end >= ". time() ." AND status = 'active' GROUP BY ads.id ";
$result = $this->db->query($sql)->result();
# GET URI PARAMS
$params = $this->uri->uri_to_assoc(3);
$limit = 3;
if($this->input->post('limit'))
{
$limit = $this->input->post('limit');
}
if(isset($params['limit']))
{
$limit = $params['limit'];
}
$offset = 0;
if(isset($params['page']))
{
$offset = $params['page'];
}
$config['num_links'] = 2;
$config['prev_link'] = '<img src="<?php echo IMG_DIR;?>arrow-start.gif"/>';
$config['prev_tag_open'] = '<span>';
$config['prev_tag_close'] = '</span>';
$config['next_link'] = '>>';
$config['next_tag_open'] = '<span>';
$config['next_tag_close'] = '</span>';
$config['first_link'] = '<';
$config['first_tag_open'] = '<span>';
$config['first_tag_close'] = '</span>';
$config['last_link'] = '>';
$config['last_tag_open'] = '<span>';
$config['last_tag_close'] = '</span>';
$config['num_tag_open'] = '<span>';
$config['num_tag_close'] = '</span>';
$config['cur_tag_open'] = '<span class="pagination-current">';
$config['cur_tag_close'] = '</span>';
$config['uri_segment'] = $this->uri->total_segments();
$config['total_rows'] = count($result);
$config['per_page'] = $limit;
$config['base_url'] = site_url('advertising/index/limit/'.$limit.'/page/');
$this->pagination->initialize($config);
$data['paging'] = $this->pagination->create_links();
$sql .= " LIMIT ".$offset.",".$limit;
#LOAD DESIGN PACKAGES
$sql = "SELECT * FROM package WHERE type LIKE '% design %' ORDER BY price DESC";
$results = $this->db->query($sql)->result();
$data['designs'] = $results;
#LOAD STANDARD PACKAGES
$sql = "SELECT * FROM package WHERE type LIKE '%standard%' ORDER BY price DESC";
$results = $this->db->query($sql)->result();
$data['standards'] = $results;
$data['params'] = $params;
$data['order_by'] = $order_by;
$data['mode'] = $mode;
$data['page'] = $page;
// View Page
//$this->template->SetHeader('advertising', '');
$this->template->SetContent('advertising/home', $data);
$this->template->View();
}
here is my example code @ view to sorting:
Code:
if ($this->uri->segment(3) == 'aktive_anzeigen'){
echo anchor('advertising/index/aktive_anzeigendesc','Aktive Anzeigen <img src="'.IMG_DIR.'down_blue.gif" border="0"/>','');
}elseif ($this->uri->segment(3) == 'aktive_anzeigendesc'){
echo anchor('advertising/index/aktive_anzeigen','Aktive Anzeigen <img src="'.IMG_DIR.'up_blue.gif" border="0"/>','');
}else{
echo anchor('advertising/index/aktive_anzeigen','Aktive Anzeigen <img src="'.IMG_DIR.'updown_blue.gif" border="0"/>','');
}
here is my example code @ view to call data
Code:
<?php echo $advertising->job_title ?>
that code still got error..
anybody can fix that with paging and sorting what data i called??
then how to customize pagination link with image, such as
Code:
$config['first_link'] = '<';
i want to change
with image arrow left for example..
help me please..
thanks for your help and your attention..