I have this script:
<?php
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles")
{
include("Articles.php");
}
?>
Which allows me to setup a custom URL for a page. Now, the problem occurs comes when I need URLs like these:
/?articles | Page that contains newest articles which loads when user clicks "< Previous" button
/?articles&1 | Page that contains older articles which loads when user clicks "Next >" button
/?articles&2 | Page that contains older than older articles
/?articles&3 | Page that contains old articles
/?articles&4 | Page that contains old articles
/?articles&5 | Page that contains oldest articles
/?articles&6 | Page that contains oldest articles, also last page in the pagination
And so on. Namely, the code in the script above would be like this:
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&1")
{
include("Articles-500.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&2")
{
include("Articles-499.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&3")
{
include("Articles-498.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&4")
{
include("Articles-497.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&5")
{
include("Articles-496.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&6")
{
include("Articles-495.php");
}
But each time the page with the newest articles gets filled (contains 10 articles per page) I have to update the script like this:
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&1")
{
include("Articles-505.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&1")
{
include("Articles-504.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&1")
{
include("Articles-503.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&1")
{
include("Articles-501.php");
}
if(urldecode($_SERVER['REQUEST_URI']) == "/?articles&1")
{
include("Articles-500.php");
}
I also need you to tell me how to use it practically in my navigation, id est: <A href="?">Next</A>
and <A href="?">Previous</A>