Welcome Guest, Not a member yet? Register   Sign In
ci4:version 4.4.3 Pagination
#1

Hello CI4,
I am working on a CI4 application with manual pagination, I have a problem with URL on the following pages, OK
http://localhost/1__codeigniter_dev/public/en/blog/1
then the following pages...
http://localhost/public/en/blog/1/2
error 404
??? an idea, below the code controllers
PHP Code:
        //custom byoosdigital.com
 
$part_uri uri_string($self_url);
        $config = array(
            'base_url'=>$self_url,
            'query_string_segment'=>'',
            'reuse_query_string'=>TRUE,
            'use_page_numbers' => TRUE;
            'total_rows'=> (int)Models::blogPost()->getCount($conditions),
            'uri_segment'=> count(explode('/'$part_uri))+1,
            'tab_uri_segment'=> $part_uri,
            'per_page'=>10,
        );
        $this->mkPagination($config); 
...
library:
PHP Code:
  // custom byoosdigital.com
  protected function mkPagination(array $config)
    {
        $pagination = \Config\Services::pager();
        $pagination->setPath($config['tab_uri_segment']);
        $pagination->setSegment($config['uri_segment']);
        if((int)ceil($config['total_rows'] / $config['per_page']) > 1){
            $this->data['pagination'] = $pagination->makeLinks($pagination->getCurrentPage(), $config['per_page'], $config['total_rows'], 'bootstrap'$config['uri_segment']);
 }
        else{
            $this->data['pagination'] = "";
 }
    
Reply


Messages In This Thread
ci4:version 4.4.3 Pagination - by byoosdigital - 11-18-2023, 12:33 PM
RE: ci4:version 4.4.3 Pagination - by kenjis - 11-18-2023, 06:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB