• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pagination

#21
[eluser]Fero[/eluser]
If I click onto category : http://www.fotoramik.sk/blog/kategoria/clanky all of the articles show up without generated pagination links. It doesn't even consider WHERE('kategoria',$category) because in http://www.fotoramik.sk/blog/kategoria/recenzie there are all articles too.

#22
[eluser]Fero[/eluser]
I have found first bug. This must be fixed to $this->db->limit(3,$start_result)

#23
[eluser]TheFuzzy0ne[/eluser]
OK, you've lost me. I don't understand why that would be the case.

If you specify "recenzie" as the category, then that the results should be from that category; assuming that "kategoria" is the name of the category field in your database table?

#24
[eluser]TheFuzzy0ne[/eluser]
[quote author="Fero" date="1235955295"]I have found first bug. This must be fixed to $this->db->limit(3,$search_result);[/quote]

Holy poop on a stick, you're right! I am constantly getting those back to front.

#25
[eluser]TheFuzzy0ne[/eluser]
You're getting there. Just need to fix the pagination on the first page, when a category isn't specified.

#26
[eluser]Fero[/eluser]
One last thing:

Please, try to go here: http://www.fotoramik.sk/blog/kategoria/clanky

Go down, click "2" and you can see it works perfectly.. but... there are not the pagination links anymore.. you have any idea why that would be? I've enabled profiler.

Anyway as you stated, model is ment to return raw data or data with html - for example forms' list or something ?

#27
[eluser]TheFuzzy0ne[/eluser]
I'm going to have to think about that one...

However, there's also another change to the pagination initialisation that might help for when the page category is not specified.

Code:
$this->pagination->initialize(
        array(
            'base_url'          => site_url('blog/kategoria/' . $category,
            'total_rows'        => $total_results,
            'per_page'          => '3',
            'full_tag_open'     => '<div id="paginglinks">',
            'full_tag_close'    => '</div>'
        ));

I'll get back to you about the no pagination issue.

#28
[eluser]TheFuzzy0ne[/eluser]
OK, I've thought about it. I think the issue is that I've been trying to make the pagination start at 1, when it wants to start at 0. Please post the model method you have now, so I can make a few slight alterations (which should fix it for good).

EDIT: In fact, changing this line:
Code:
$start_result = ( ! is_numeric($start_result) || $start_result <= 1) ? 0 : $start_result - 1;

to this one
Code:
$start_result = ( ! is_numeric($start_result) || $start_result < 0) ? 0 : $start_result;

Should fix it.

EDIT2: And this block:
Code:
// If $category is a number, the it must be the start result
    if (is_numeric($category))
    {
        $start_result = $category; // Set the correct start result.
        $category = ""; // Set category to "".
    }

needs to appear above that line.

#29
[eluser]Fero[/eluser]
Fuzzy, nice, but paginating works, however the paginiation links do not get generated .. I tried to echo echo $this->pagination->create_links(); right after initialization but it realyl doesn't make anything out of it.. on the seconds page.

Pagination links ARE on the first page of category webpage but they do not appear on the second page.

#30
[eluser]TheFuzzy0ne[/eluser]
OK, please can I see your model method again now you've made some modifications?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.