Welcome Guest, Not a member yet? Register   Sign In
Pagination problem!


This is the first time I using pagination and I thought it would work but... it didn't! Tongue

Controller file:
$images = $this->db->query("SELECT * FROM images WHERE page = ". intval($id->id));

        $config['base_url'] = site_url('page/imagegallery/'. $this->uri->segment(3));
        echo $config['base_url'];
        $config['total_rows'] = $images->num_rows();
        $config['per_page'] = '2';
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';


View file:
echo $this->pagination->create_links();

In the controller file:
First I load the class.
Set the base_url and I checked that: http://www.example.se/cms/index.php/page...gallery/23 //This is the url to the function in the controller with a segment = 23

total_rows = Count all rows in the table
per page = I just want to show 2 rows

Then I initialize it... funny Tongue

The problem is:
It doesn't matter if i write in the adress field: you can see the picture here:

The number in the adressfield is 2 now, if I change it to something else, the number 3 on page, sitll beeing fat/strong styled.
If I don't write any number/segment, I only got errors!

Please, can you help me wtih this!

Thanks //WebbHelp

please somebody, it would be extra extra nice if I could get the answer today, sry to say it but I am in hurry Tongue

Sry to write again but i really need att answer

Thanks thanks //webbhelp


Here is a link you can see the problem! (only when the server is online
Remember that you need to write a number as a segment, if no number, you got error please, I really need help with this Smile

I will try to help you.

Try this.

$config['base_url'] = base_url('page/imagegallery/');

I am very glad that you try, I think it's very kind of you, specially know when I really need this help Smile

I don't think that is correct because, page/imagallery is the link that run's the controller: imagegallery after that I got the segment... in this case it is: 123123 (Usually it is not a number.
After that I got another sgement, that is for the paging system.

So the base_url is page/imagegallery/123123 because the imagegallery's name is: 123123.

I can tell you that this is a CMS, and this is a imagegallery admin created with the menulink name 123123.

Thanks //WebbHelp

Really hope you can help me Smile

It looks like you need to set the uri_segment in your pagination config, try:

$config['uri_segment'] = '4';

Thank you so so so much for reply!

it worked a little bit more, but There are 5 images which is supposed to be shown, but it is only one image per pagination page!

You can see it on the adress: http://server.webbhelp.se/cms/index.php/...y/123123/1

I forgot to say that in the left corner of the page (0px,0px) you see the base_url and under that you see the num_rows() of images!

can you paste your most recent controller file, the entire file ? Also where is the $id being defined ?

Theme © iAndrew 2016 - Forum software by © MyBB