Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
pagenation rendering
  • this is my controller code:
            $view = View::forge('page');
            $view->name = "Santosh";

            $pagination = Pagination::forge('mypagination', array(
        'uri_segment' => 2,
        'total_items' => 3,
        'per_page' => 3,
    ));
              $data = Model_Pagetable::query()
                                ->limit($pagination->per_page)
                                ->offset($pagination->offset)
                                ->get();
               $view->page =Pagination::instance('mypagination')->pages_render();         
                  $view->data = $data;
            return $view;
    and this view i am echo this code but i am not able to see the page link code 
    and also the link to other page is not proper and i am not able to see the next iteams
    Please help me in this this is the last phase of my fuelphp learn task.
    please help  
     
  • You're storing the rendered HTML into $view->page, which will be escaped by the View object.

    Either use

    $view->set_safe('page', Pagination::instance('mypagination')->pages_render());

    or pass the Pagination instance itself to the View. When you echo the instance, the object will auto-render itself.

    Also, you have defined uri_segment 2, but in the pagination_url, the segment for the page number is 3 (page is 1, index is 2).
  • i am able to solve the current problem But i have another problem,
    My URL is not right the next or the pageing button are not right that are as follow :
    but the current page URL is right i have set the url is this way.


    and thankx for the early problem.
  • and i still confuse about uri_segment if i am seting it for 5 then my pagenation link is set properly,
    but the result is not what i want or it is not the next record it is the same record,
    wht is url segment need to do with the result
  • My previous reply is wrong, I'd assumed some rewriting was used, but it looks like your public folder is actually part of the URL...

    For the uri_segment, ALL segments in the URL are counted (excluding the hostname, since that is not a segment). So for

    'pagination_url' => 'http://localhost/fuelphpn/public/page/index/',

    the uri_segment should be 5, since there are 4 existing segments (fuelphpn, public, page and index), and which will create

    http://localhost/fuelphpn/public/page/index/3

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion