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

[eluser]WebbHelp[/eluser]
Hi!

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


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

        $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>';

        $this->pagination->initialize($config);




View file:
Code:
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:
http://image.webbhelp.se/error.jpg

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
#2

[eluser]WebbHelp[/eluser]
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
#3

[eluser]WebbHelp[/eluser]
Sry to write again but i really need att answer

Thanks thanks //webbhelp
#4

[eluser]WebbHelp[/eluser]
http://server.webbhelp.se/cms/index.php/...y/123123/1

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
#5

[eluser]fraserk[/eluser]
I will try to help you.

Try this.

Code:
$config['base_url'] = base_url('page/imagegallery/');
#6

[eluser]WebbHelp[/eluser]
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
#7

[eluser]skylerrichter[/eluser]
It looks like you need to set the uri_segment in your pagination config, try:


Code:
$config['uri_segment'] = '4';
#8

[eluser]WebbHelp[/eluser]
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
#9

[eluser]WebbHelp[/eluser]
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!
#10

[eluser]skylerrichter[/eluser]
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