无法在url codeigniter分页中传递值

时间:2016-05-13 06:29:07

标签: php codeigniter model-view-controller

我的分页代码如下。我无法从url中获取值,并且分页也不起作用:

public function categories_product(){
    $categoryid   = $_GET['catId'];
    $categoryname = $_GET['cname'];
    $data = array();

    $config["base_url"] = base_url() . "pages/categories_product?catId=".$categoryid."&cname=".$categoryname ;
}

2 个答案:

答案 0 :(得分:0)

尝试这可能而不是使用查询字符串(我认为你需要在Codeigniter配置文件中启用查询字符串,但我不确定,因为我很长时间没有使用它)

Workbook workbook = doc.WorkbookPart.Workbook;
            BookViews bookViews = workbook.GetFirstChild<BookViews>();
            WorkbookView workbookView = bookViews.GetFirstChild<WorkbookView>();
            var activeSheet = workbookView.ActiveTab.InnerText;
            string sheetName = doc.WorkbookPart.Workbook.Descendants<Sheet>().ElementAt(Convert.ToInt32(activeSheet)).Name;

此外,这对SEO更友好,而且在Codeigniter风格中更多。

在此处http://www.codeigniter.com/user_guide/libraries/pagination.html

查找自定义分页

答案 1 :(得分:0)

$this->load->library('pagination'); 
$config['per_page']= 10;
$config['uri_segment'] = 4;
$config['base_url'] = 'URL where you want to run pagination';

计算总记录数

$this->data['totalcount'] = 'total records';

初始化库

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



$this->data['paginglinks'] = $this->pagination->create_links();

        $this->data['per_page'] = $this->uri->segment(4);

        $this->data['page'] = $offset;
    $this->data['per_page_display'] = $config['per_page'];