NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Tough Logic Problem: Forum Pages

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 12-26-2005, 11:20 AM THREAD STARTER               #1 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)

Tough Logic Problem: Forum Pages


Alright, help me figure this out

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:

????: NamePros.com http://www.namepros.com/programming/151357-tough-logic-problem-forum-pages.html

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
mholt is offline  
Old 12-26-2005, 11:41 AM   #2 (permalink)
mch
NamePros Regular
Join Date: Nov 2005
Location: EU
Posts: 248
mch is on a distinguished road
 



Just a quick idea, I hope this is what you mean.

PHP Code:
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 "\">< 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)
????: NamePros.com http://www.namepros.com/showthread.php?t=151357
{
    echo 
"<a href=\"topic.php?page=$TOTALPAGES\">Last >></a> ";
}

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

mch is offline  
Old 12-26-2005, 01:09 PM   #3 (permalink)
Eating Pie
 
iNod's Avatar
Join Date: Nov 2004
Location: Canada
Posts: 2,272
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
 


Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
This would be pagination
I was going to type you up but it was getting kinda long.

Here is a turorial http://www.phpfreaks.com/tutorials/43/5.php

iNod.
__________________
I feel old.
iNod is offline  
Old 12-26-2005, 03:49 PM THREAD STARTER               #4 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Wow, thanks both! ^_^

Lol, thanks for the link iNod.

I'll expirement and update you ASAP.
mholt is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating A Successful Forum Morgan Website Development 33 05-10-2006 04:20 AM
Forum problem... zack Web Design Discussion 3 09-03-2005 05:47 AM
Phpbb Olympus : Latest Version Of Most Popular Free Forum Software Ferman Domains For Sale - Make Offer 1 06-03-2005 04:37 PM
Advice about purchasing a forum.. Mateja Website Development 6 08-08-2003 12:39 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:23 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger