Paged detection in php when using Ajax?

Forums › Forums › Search & Filter Pro › Paged detection in php when using Ajax?

Tagged: ,

Viewing 5 posts – 1 through 5 (of 5 total)
  • Anonymous
    #219085

    Hello,

    I have created a custom template for the results and are having trouble with one part. On the first/initial page of results (displaying all) the first 3 posts are formatted differently than the rest of the posts. That’s easy enough to do in my template file. However, on the second page of results I don’t want the first 3 formatted differently. If I wasn’t using Ajax I know I could use !is_paged() to find out if I’m on the first/initial page of results. But that is not working…I’m guessing because the form is using ajax to load the results results.

    Does anyone know of a way in PHP that I can detect whether or not I’m on the first page of results when being loaded using Ajax?

    Trevor
    #219101

    Does the URL have sf_paged in it?

    Anonymous
    #219138

    Hi Trevor,

    Yes the url does have sf_paged in it. Should is_paged() be working?

    Anonymous
    #219142

    Ok I think I might have figured it out. I tried using:
    !isset($_GET['sf_paged']) and it appears to be working!!!

    If this is not the correct way to do so please let me know.

    Thanks

    Trevor
    #219146

    That was what I was going to suggest. I will close this thread for now.

Viewing 5 posts – 1 through 5 (of 5 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.