Unstoppable Domains

Tough Logic Problem: Forum Pages

Spaceship Spaceship
Watch

user-7256

VIP Member
Impact
111
Alright, help me figure this out :hehe:

I'm having trouble dividing the replies of a thread into page numbers that you can click on (Like on these forums, if there's a topic with a lot of pages, it shows something like this:


Page 1 of 92 1 2 3 4 5 > Last »


And this is when you VIEW a thread, not on the list of threads (Board display).

..Or, if you're in the middle of the pages, it displays like this:


Page 9 of 92 « First < 5 6 7 8 9 10 11 12 13 > Last »


And if you're at the end...


Page 92 of 92 « First < 88 89 90 91 92


How can I do this with the software that I'm writing (forum software)? Can anybody give an example?

Thanks a lot,
-Matt
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Just a quick idea, I hope this is what you mean.

PHP:
echo "Page $currentpage of $TOTALPAGES ";

if ($currentpage != 1)
{
	echo "<a href=\"topic.php?page=1\"><< First</a> ";
}

if ($currentpage > 5)
{
	echo "<a href=\"topic.php?page=" . $currentpage - 1 . "\">< Previous</a> ";
}

for ($i = -5; $i <= 5; $i++)
{
	if (($i > 0) && ($i <= $TOTALPAGES)) 
	{
		echo "<a href=\"topic.php?page=" . $currentpage + $i . "\">" . $currentpage + $i . "</a> ";
	}
}

if ($currentpage != $TOTALPAGES)
{
	echo "<a href=\"topic.php?page=$TOTALPAGES\">Last >></a> ";
}

if ($currentpage < $TOTALPAGES - 5)
{
	echo "<a href=\"topic.php?page=" . $currentpage + 1 . "\">Next ></a> ";
}
 
0
•••
0
•••
Wow, thanks both! ^_^

Lol, thanks for the link iNod.

I'll expirement and update you ASAP.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back