Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Construct pagination link
  • Dear sir,

    Is it possible to make a link like following?

    <a href="javascript:document.form1.submit();">3</a>

    This is because I have an index page with your pagination.

    But, when I put filter function implemented by POST method to my index page and click on pagination, my filter dose not work at all because of GET method is used in your pagination.

    Therefore, I thought I can use javascript to make it like submit button.

    Howeer, when I put javascript into pagination_url, the url was like this following.

    javascript://document.form1.submit();?=3

    Do you know how to solve this issue?

    Or, do you have an idea for this?

    Best regards,
  • HarroHarro
    Accepted Answer
    When you use a filter, you need to pass the filter on to the next request, because as you said, you loose the search string.

    To do so, we use a flash session variable.

    I tried to create an example for you: http://bin.fuelphp.com/snippet/view/M7

    Alternatively, use a GET variable, which has the added benefit of being able to bookmark the search. To do this, simply use a pagination URL like

    \Pagination::instance()->pagination_url = \Uri::create('sessions/index').'?search='.$search;

    to pass the search argument on to the next page.
  • Dear Harro,

    Thank very much for your quick response.

    I will try both of them and determine which one is better for my pages.

    Thanks a lot :)

    Best regards,

Howdy, Stranger!

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

In this Discussion