Hi there!
New to the forum and with a problem. Articles on my site are divided in max 3 pages. If I have more than one page, I would like next and previous links (next on the bottom and previous on the top of the article). Here is what I came up with. It works but I would like to know if there is a better way. 🙂
Thanks in advance from Slovenia
<?
if ($pageCount == 2) {
if (!isset($_GET['page'])) {
$next = '<a href="index.php?action=article&aid='.$_GET['aid'].'&page=1">Next</a>';
$prev = "";
} elseif ($_GET['page'] == "1") {
$prev = '<a href="index.php?action=article&aid='.$_GET['aid'].'">Previous</a>';
$next = "";
}
} elseif ($pageCount == 3) {
if (!isset($_GET['page'])) {
$next = '<a href="index.php?action=article&aid='.$_GET['aid'].'&page=1">Next</a>';
$prev = "";
} elseif ($_GET['page'] == 1) {
$prev = '<a href="index.php?action=article&aid='.$_GET['aid'].'">Previous</a>';
$next = '<a href="index.php?action=article&aid='.$_GET['aid'].'&page=2">Next</a>';
} elseif ($_GET['page'] == "2") {
$prev = '<a href="index.php?action=article&aid='.$_GET['aid'].'&page=1">Previous</a>';
$next = "";
}
}
?>