繁体   English   中英

如何在uri-> segment(1)中路由分页的下一页,例如(example.com/1)

[英]how to route pagination next page in uri->segment(1) eg (example.com/1)

我在前台索引页分页example.com当我点击我要加载页面例如像分页两页example.com/1

<?php 

function index()
{
    $e = $this->employer_model->count_jobs_with_employer();
    //print_r($e) ;
    $config['base_url'] = $this->config->site_url(); //set the base url for pagination
    $config['total_rows'] = $e; //total rows
    $config['per_page'] = '10'; //the number of per page for pagination
    $config['uri_segment'] = 1; //see from base_url. 3 for this case        
    $config['first_link'] = 'First';
    $config['last_link'] = 'Last';

    $config['full_tag_open'] = '<div class="pagination">';
    $config['full_tag_close'] = '</div>';
    $this->pagination->initialize($config); //initialize pagination

    $page  = ($this->uri->segment(1)) ? $this->uri->segment(1) : 0;

    $joblist['listemp'] = $this->employer_model->employerbyjob($config['per_page'], $page); 
    foreach($joblist['listemp'] as $emp)
    {
        $joblist['jobs'][$emp->u_id] =   $this->employer_model->get_ByTbl_Col('employer_post_job', 'e_id', $emp->u_id,'dead_line', date('Y-m-d'));  
    }

    $c['job_list'] = $this->load->view('front/blocks/employer/job_list', $joblist, TRUE);
}
?>

这样的事情应该起作用:

application / config / routes.php:

//default routes:
$route['default_controller'] = "yourcontroller";
$route['404_override'] = '';

// your custom route:
$route['(:num)'] = "yourcontroller/index/$1";

应用程序/控制器/Yourcontroller.php

function index($page = null)
{

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM