google-code-export / ci-cms

Automatically exported from code.google.com/p/ci-cms
Other
0 stars 0 forks source link

i want to create ci pagination on base_url like example.com/1 but not working #53

Open bthulung opened 9 years ago

bthulung commented 9 years ago

my controller look likes public function example($typeId = "") { $this->table = 't1'; $str = ''; $nowDate = date('Y-m-d'); $join = array(array("e", "e.userid = jobs.userId", "left"), array("post_type", "post_type.id = js.post_type", "left"));

    $config = array();
    $config["base_url"] = base_url();
    $config['first_url'] = '1';
    $total_row = $this->job_model->record_count($typeId);
    $config["total_rows"] = $total_row;
    $config["per_page"] = 2;
    $config['use_page_numbers'] = TRUE;
    $config['num_links'] = $total_row;
    $config['cur_tag_open'] = '&nbsp;<a class="current">';
    $config['cur_tag_close'] = '</a>';
    $config['next_link'] = 'Next';
    $config['prev_link'] = 'Previous';

    $this->pagination->initialize($config);
    $page = ($this->uri->segment(1)) ? $this->uri->segment(1) : 0;
    $result = $this->job_model->fetch_pagination($config["per_page"], $page, $typeId, $join);

//$result = $this->job_model->get("js.*, e.company as companyname, e.filename as logo", array("post_type" => $typeId, "Date(js.apply_before) >=" => $nowDate), $join, "", $limit, "", false);
//echo count($result);
//die();
if ($result) {
  foreach ($result as $row) {
      //$urltitle = str_replace(" ", "", $row->title);

    $newdate = explode(" ", $row->apply_before);
    $now = strtotime(date('m/d/Y'));
    $my_date = strtotime($newdate['0']);
    $datediff = $my_date - $now; 

    $extractDate = floor($datediff/(60*60*24));
    //$str = $extractDate;
    if($extractDate >=0) {
    $str .= '<div class="ro clearfix"><div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">';
    if(file_exists(EMR_DIR. $row->clogo) && !empty($row->clogo)) {
    $str .= '<img src="'.EMR_DIR. $row->clogo.'" width="52" height="48">';
    }
    else {
    $str .= '<img src="public/images/clogo.jpg" width="52" height="48">';
    }
    $str .='</div><div class="col-lg-7 col-md-7 col-sm-7 col-xs-10"><div class="post">' .$row->companyname . '</div> <div class="slo">'.$row->title;
    $str.='</div></div><div class="clearfix visible-xs"></div>
                  <div class="clearfix visible-xs" style="margin-top:5px;"></div>
                  <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">';
    if($extractDate ==0)
    $str .='<button class="btn btn-danger btn-xs pull-right"> Today is Last Date';
    else
    $str .='<button class="btn btn-danger btn-xs pull-right">'.$extractDate.' Day(s) Left';

    $str.='</button></div></div>';
  }
  }
}
return $str . '<br>'.$this->pagination->create_links();

}

i have a template with module run where i create pagination <!DOCTYPE HTML> <\html> <\head> <\head> <\body> <?php echo Modules::run("job/getotherJobtype", "3", 10); ?> <\body> <\html>

my route look like this $route['(:num)'] = "home";

my url looks like example.com/1 now my error is previous link is not showing on click next button and the number not change on next button link and the first 1 link don't get any link can any one got idea about it