We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    I’m working on paginating results from a custom Snippet, and I’ve noticed that the $_SERVER[’PHP_SELF’] variable always returns the index.php?id=55 type of page name (minus the id bit)... I thought it would work if friendly URLs were enabled, but it doesn’t... so here’s my solution for the benefit of others:

    On somepage.html, I wanted a link to somepage.html?page=2, so I used the following:
    1. a base tag in my template head referencing my domain name, e.g.
    <base href="http://mydomain.com"/>

    2. I retrieved the friendly url using the $_GET[’q’] variable, so I could generate a link back to the same page using
    $next_pg_target = $_GET['q'] . '?page=' . $next_pg_num;


    Hope this helps someone. Cheers.