Welcome Guest, Not a member yet? Register   Sign In
pagination didn't work
#11

[eluser]mah0001[/eluser]
Can you re-post your controller code?
#12

[eluser]marjune[/eluser]
Code:
function index(){
    $this->load->helper('form');
    $this->load->helper('url');
    $this->load->library('pagination');
    $config['base_url'] = base_url().'furoms/';
    $config['per_page'] = '5';
    $config['uri_segment'] = 3;
    $config['total_rows'] = $this->db->count_all('forum_topic'); // 9 records result
    $config['open_tag'] = '<p>';
    $config['close_tag'] = '</p>';
    $this->pagination->initialize($config);
    $furomcontent['data'] = $this->furom->furomcontent($config['per_page'], $config['uri_segment']);
    $this->load->vars($furomcontent);
    $this->load->view('viewfurom');
            
}
#13

[eluser]mah0001[/eluser]
Change the
Code:
$config['per_page']=2;

1. test if any of the URLs return anything:

<yoursite>/index.php/furom/index/
<yoursite>/index.php/furom/index/2
<yoursite>/index.php/furom/index/4
<yoursite>/index.php/furom/2

2. You need to check if your index() function is being called when you try the above URLs. Put a print statement inside the index function to confirm.

3. Post the results of the tests 1 and 2.
#14

[eluser]marjune[/eluser]
ok, i confirmed that the index() function was being called when i try this urls <yoursite>/index.php/furom/index/4, <yoursite>/index.php/furom/index/2, and <yoursite>/index.php/furom/index/ because i print a test in the index() function then the test appears for those urls, but the page was not found if i used this <yoursite>/index.php/furom/2
#15

[eluser]mah0001[/eluser]
On any pages except the first page, you don't see the pagination bar or the db rows? Could you post your view code?
#16

[eluser]marjune[/eluser]
in my view
Code:
&lt;?php echo $this->pagination->create_links(); ?&gt;

pagination like this
1 2 3 4 > Last ›
#17

[eluser]mah0001[/eluser]
But do you see it displayed on the pages:

<yoursite>/index.php/furom/index/2
<yoursite>/index.php/furom/index/4
#18

[eluser]marjune[/eluser]
no changes in these urls <yoursite>/index.php/furom/index/2, <yoursite>/index.php/furom/index/4 same as <yoursite>/index.php/furom output
#19

[eluser]mah0001[/eluser]
What do you mean by no change? do you see the same records on /index/2 or /index/4 pages or you see nothing on any page? Could you explain the output of the pages a bit more?
#20

[eluser]marjune[/eluser]
i mean the out put of /index/2 and /index/4 is the same records of /index.php/furom




Theme © iAndrew 2016 - Forum software by © MyBB