pagination help.

Started on the old forum in September 2011 · view the original in the archive · old links redirect here

2 replies · 427 views · started 15 years ago · 1 min read

2 participants
atef Developer · 224 posts #1

hello mates, iam using this pagination script

if($page == ceil($NumOfPages) && $page != 1)
{
for($i = 1; $i <= ceil($NumOfPages) -1; $i++)
{
if($i > 0)
{
echo "<a class=\"pagenav\" href=\"index.php?page={$i}\">{$i}</a>"; }
}
}
if ($page == ceil($NumOfPages)) {
$startPage = $page;
} else {
$startPage = 1;
}
for ($i = $startPage; $i <= $page +6; $i++)
{
if ($i <= ceil($NumOfPages)) {
if($i == $page)
{
echo "<span class=\"currentpage\"><b>{$i}</b></span>";
} else {
echo "<a class=\"pagenav\" href=\"index.php?page={$i}\">{$i}</a>";
}
}
}

but its print many page and looks sux. please how to make it looks like johncms when it more than 4 pages e.x [1] [2] [3] ... [14] thanks 🙂

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close