Welcome Guest, Not a member yet? Register   Sign In
About pagination
#1
Information 

I am using CI3 and the pagination is not working on the second page. Is that i am missing something? Here is my code from the controller:
PHP Code:
public function tags($task "list")
    {
        
$header['title'] = 'Tag List';
        
$this->load->view("template/header"$header);
        
$this->load->view("template/dashboardNavView");

        
$builder ['task'] = $task;

        if(
$task == "list" || $task == "")
        {

            
$pager['base_url'] = "/dashboard/tags/";
            
$pager['total_rows'] = $this->db->count_all('tags');
            
$pager['per_page'] = 4;
            
$pager["uri_segment"] = 3;
            
$this->pagination->initialize($pager);

            
$page $this->uri->segment(3);

            
$builder['tags'] = $this->db->order_by('id''DESC')->limit($pager['per_page'], $page)->get('tags')->result();
            
$builder['pager'] = $this->pagination->create_links();

        }

        
$this->load->view("tags/TagsBuilderView"$builder);
        
$this->load->view("template/footer");
    } 

Everything seems ok, but when i click on the second link then empty view returned.
Reply
#2

Try to this without the / ...

$pager['base_url'] = "/dashboard/tags";

Reply
#3

Thankyou for your response, i tried with
$pager['base_url'] = "/dashboard/tags";
but it doesn't work also i tried with full url with no success.
Reply
#4

What about $pager['base_url'] = "/dashboard/tags/list";

Reply
#5

Many thanks @Rufnex for your time, you point me into the right direction. However shipping everything into a new method seems works just perfect! Smile
Reply
#6

Glad to help you Wink

Reply




Theme © iAndrew 2016 - Forum software by © MyBB