I'm new to PHP, and I'm developing a PHP plugin for CraftCMS.
On my local dev machine, this code was working; however, on the server, the pagination links are not directing properly.
This is a plugin which imports an XML feed and paginates the results.
For example, when using 'PHP_SELF' in the code, the link redirects to the index page, and when using 'REQUEST_URI,' the link works correctly the first time, yet is appended with each successive URI.
I was wondering if there would be a work around or better method for correcting this problem?
This version takes you back to the home page: code:
echo '<a href="'.$_SERVER['PHP_SELF'].'?page=1#rss" title="First" class="btn"><<</a> <a href="'.$_SERVER['PHP_SELF'].'?page='.( $page - 1 ).'#rss" title="Previous" class="btn prev"><</a> ';
while this version appends the querystring each time: e.g. http://mypage/test?page=1&page=2
code:
echo '<a href="'.$_SERVER['REQUEST_URI'].'?page=1#rss" title="First" class="btn"><<</a> <a href="'.$_SERVER['REQUEST_URI'].'?page='.( $page - 1 ).'#rss" title="Previous" class="btn prev"><</a> ';