Current location: Hot Scripts Forums » Programming Languages » PHP » previous & next links assistance needed...


previous & next links assistance needed...

Reply
  #1 (permalink)  
Old 12-29-03, 11:57 AM
Soulidified Soulidified is offline
Newbie Coder
 
Join Date: Jul 2003
Location: West Side
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Angry previous & next links assistance needed...

Hello PHP world... I am workin on a website, soulidified.net/worldpolitics.php
right now I have it selecting the latest link out of a database and its corresonding comments on the same page. Now as you can see, articles can get pretty lengthy. My question is this:

1. How can I create next previous links for the latest article in a table... so for example.. lets say i have an article called world dilemmas and it has the highest ID in my table. How do I select that article and segment it into next previous pages?

hope you guys can help me out! I give props to anyone who can on my website!

Jaesoul
__________________
"Go Bigger"
Reply With Quote
  #2 (permalink)  
Old 12-29-03, 12:20 PM
hyjacked hyjacked is offline
Wannabe Coder
 
Join Date: Nov 2003
Location: New Brunswick, Canada
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
when you select it from the table, store the body in a variable.

check the lenght of the variable.
if length > max_per_page or continued == true
{
-continued = true; //used to control when you are switching pages

-break the string(body) up into segments(at least take out the piece you wish to post. Would also be good to find the last space in the segment so you are not splitting words up.) something like current_page*max_per_page should get you where to start the segment.

-calculate the number of pages: length / max_per_page should work

-print segment, page numbers/links, etc
}
else
{
-print body
}

Note: When switching pages, be sure to store which article is being used, which page you wish to go to, etc. You need to pass this info around so you can retrieve it when generating the next segment.

hopefully this will give you some direction. Best of luck.
__________________
hyjacked

Last edited by hyjacked; 12-29-03 at 12:22 PM.
Reply With Quote
  #3 (permalink)  
Old 12-29-03, 03:42 PM
Soulidified Soulidified is offline
Newbie Coder
 
Join Date: Jul 2003
Location: West Side
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
thank you for your help...

I am a novice user for PHP, so i am not clear on what you are saying, although I have copied your suggestion, and am doing reasearch on it to figure out what it means haha... I was wondering sir, do you know of any good tutorials that would esplain step by step how to do this process... I have tried it myself but i have been unsucessfull.
__________________
"Go Bigger"
Reply With Quote
Reply

Bookmarks


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
automotive site links... 0patience Traffic Exchange 2 12-15-03 07:18 PM
Developer needed to database pre-written script twastudios Script Requests 0 11-19-03 01:16 PM
Thousands of dead links Giant Hot Scripts Forum Questions, Suggestions and Feedback 6 08-03-03 10:30 PM
Problem with java links Kingfishsj JavaScript 0 08-01-03 08:09 AM
Targeting links using javascript Greg JavaScript 4 06-30-03 04:06 PM


All times are GMT -5. The time now is 07:48 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.