#StackBounty: #codeigniter #codeigniter-3 Need understanding $config["uri_segment"] related code in CodeIgniter

Bounty: 50

Hey CodeIgniter developers I am new in codeIgniter please see my code related to pagination. Pagination is working fine. I just need your help to understand few lines of code, please see the commented lines in code where I just need your help to understand it.

public function example1() {
        $config = array();
        $config["base_url"] = base_url() . "welcome/example1";
        $config["total_rows"] = $this->services->record_count();
        $config["per_page"] = 10;
        $config["uri_segment"] = 3; // Need help on this line
        $config["next_link"] = '>';
        $config["prev_link"] = '<';

        // Need help on this if condition blocks
        if ($this->uri->segment(3)) {
            $page = ($this->uri->segment(3));
        } else {
            $page = 1;
        $data["results"] = $this->services->fetchServicesByPagination($config["per_page"], $page);
        $data["links"] = $this->pagination->create_links();

        $this->load->view("example1", $data);

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.