Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Pagination Issue
  • I recently upgraded my FuelPHP to v1.5. Now I'm trying to set up the pagination class.

    This is my code:

    $data['news'] = Model_News::find()->where('font', '>', -1);
            $count = count($data['news']);

            $config = array(
                    'pagination_url' => 'http://localhost/public/mobile/barbecue/',
                    'total_items'    => $count,
                    'per_page'       => 12,
                    'uri_segment'    => 3,
            );

            $pagination = Pagination::forge('mypagination', $config);

            $data['news'] = Model_News::find()->where('font', '>', -1)->order_by(array('date' => 'desc'))->limit($pagination->per_page)->offset($pagination->offset)->get();
            $data['pagination'] = $pagination->render();
            $this->template->title = "Teams";
            $this->template->content = View::forge('news/index', $data);

    I made a copy of the core/config/pagination.php to app/config/pagination.php. And on my view news/index.php the pagination is seted: <?php echo $pagination ?>

    Result:the information obtained by the query are displayed normally, but the string $ pagination returns nothing. Fuel displays no error.

    What I do? Thanks.
  • The only thing I can find wrong with this, is that you render in the controller. This will produce HTML, which will be escaped when you send it to the view like this.

    But that would not result in no data, but in an HTML dump echo'd on your page.

    Are you sure there is more then one page? If not, pagination will not display anything.

Howdy, Stranger!

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

In this Discussion