SitePoint Sponsor |
|
User Tag List
Results 1 to 11 of 11
Thread: Name of Each "Next" Page
-
Aug 4, 2000, 18:34 #1
- Join Date
- Jul 1999
- Location
- Helena, MT
- Posts
- 287
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
I am refering to Kevin's tutorial.
I can use the text [PAGEBREAK] in each article to split the page up into different pages. But instead of using the "Continue to Next Page" text, I want to be able to specify what text to use in each link to the next page.
In a previous post, Karl posted the following:
----------------------------------------
Like Chris said you can use [PAGEBREAK] for the page breaks, if you want to give each page a different name to page 1, page 2 etc. then you could use [PAGEBREAK=NameOfNextPage] and use a regular expression to split the page up and give you the name of the next page.
----------------------------------------
Can someone tell me what a regular expression is and how I am supposed to use that to do what I am wanting to do? I already got it to split up the article into different pages.
Thanks!
Chris Roane
------------------
Web Services: DevStorm | Intersurge
Web Tools: Web Site Resource | Free Web Site Tools
[This message has been edited by wsresource (edited August 04, 2000).]
[This message has been edited by wsresource (edited August 04, 2000).]
-
Aug 5, 2000, 01:01 #2
- Join Date
- Apr 2000
- Location
- Posts
- 272
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I've done just that. But instead of typing just [PAGEBREAK] you will also have to type something like [NEXTPAGE=Text that links to next page] and it works without a hitch. Here's the code I have used:
Code:$nextID = $pid + 1; $articleText = eregi_replace("\[NEXTPAGE=([-_./a-zA-Z0-9 !&%#?,'=:~\"]+)]","<A HREF=\"/article.php?aid=$aid&pid=$nextID&cid=$cid\">\\1</A><FONT COLOR=\"red\">>></FONT>",$articleText);
[Edited by kyank on 11-07-2000 at 12:14 AM]
-
Aug 6, 2000, 20:31 #3
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Looks good to me, Pedro! It's incredibly rewarding to see people expanding on the code I've presented. It really convinces me that I've provided you with new skills, rather than just code fragments for you to cut and paste!
------------------
-Kevin Yank.
http://www.SitePoint.com/
Helping Small Business Grow Online!
-
Aug 7, 2000, 01:24 #4
Thats cool.
Now how do I also add a menu at the bottom that looks like "<<Back 1 2 3 4 5 6 7 Next>>" so that people can use these links to jump from page 1 to page 5 without having to load 5 pages?
------------------
Jeremy Luebke --> jeremy@coolresources.com
CoolResources.com --> Part of the W3Nation Network
[Edited by kyank on 11-07-2000 at 12:15 AM]
-
Aug 7, 2000, 04:10 #5
- Join Date
- Aug 1999
- Location
- Pittsburgh, PA, USA
- Posts
- 3,910
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
HEY! What's wrong with cut-and-paste?
------------------
Chris Bowyer – chris@mycoding.com
MyCoding.com: Visit for Launch Notification!
DomainMailings.com: Who Says All The Good Ones Are Taken?
MovieForums.com: Talk About Your Favorite Flicks!
[Edited by kyank on 09-16-2000 at 10:14 AM]
-
Aug 7, 2000, 05:58 #6
- Join Date
- Apr 2000
- Location
- Posts
- 272
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You've experienced the same problem as me! No line breaks! It's annoying, eh?
[Edited by kyank on 09-16-2000 at 10:14 AM]
-
Aug 7, 2000, 12:06 #7
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Now how do I also add a menu at the bottom that looks like "<<Back 1 2 3 4 5 6 7 Next>>" so that people can use these links to jump from page 1 to page 5 without having to load 5 pages?
Code:// $fulltext was fetched from the DB. $regexp = "\[NEXTPAGE=([-_./a-zA-Z0-9 !&%#?,'=:~\"]+)]"; $numpages = count(split($regexp,$fulltext));
------------------
-Kevin Yank.
http://www.SitePoint.com/
Helping Small Business Grow Online!
[Edited by kyank on 11-07-2000 at 12:15 AM]
-
Nov 7, 2000, 09:38 #8
- Join Date
- Jul 2000
- Location
- Nowhere
- Posts
- 278
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Uhhm... maybe it's because I'm not as good-thinking as others but yet I don't know how to display the text for the second page or any other pages.
I already split up the full text and also the page numbers with their corresponding page ID is there. Only the content is missing
please help...
-
Nov 8, 2000, 08:22 #9
- Join Date
- Apr 2000
- Location
- Melbourne, Australia
- Posts
- 2,571
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Okay, say we want to view page 5. Thus, $pid is set to 4.
Code:// $pid = 4 indicates we want page 5. // $fulltext was fetched from the DB. $regexp = "\[NEXTPAGE=([-_./a-zA-Z0-9 !&%#?,'=:~\"]+)]"; $pages = split($regexp,$fulltext); $numpages = count($pages); $pagecontent = $pages[$pid];
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
-
Nov 8, 2000, 10:36 #10
- Join Date
- Jul 2000
- Location
- Nowhere
- Posts
- 278
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Wow, thanks!! Thank you so much!
I've made some changes, to make things easier (not sure, if better)
Code:// $content was fetched earlier // insert "PAGEBREAK" if you want to start a new page $fulltext = split( "PAGEBREAK", $content ); if ( !$pid ) $pid = '1'; $numpages = count( split( "PAGEBREAK", $content ) ); // only display "Page [int]" if there are more than one pages if ( $numpages > 1 ) { echo "<b><i>Page " . $pid . "</i></b>\n"; } echo $fulltext[$pid-1]; if ( $numpages > 1 ) { echo "<table><tr><td bgcolor=#eeeeee align=center>"; for ( $i=1; $i<$numpages+1; $i++ ) { echo "<b><a href=\"?id=" . $id . "&pid=" . $i . "\">" . $i . "</a></b> "; } }
-
Nov 24, 2000, 09:54 #11
- Join Date
- Nov 1999
- Location
- Singapore
- Posts
- 31
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Okay, sorry about this, but I'm confused even more.
What I think I understand:
$regexp = "\[NEXTPAGE=([-_./a-zA-Z0-9 !&%#?,'=:~\"]+)]";
$numpages = count(split($regexp,$fulltext));
Am I correct in saying that what the lines above do is this: It looks for the "[NEXTPAGE]", while $numpages counts how many [NEXTPAGE]s there are, ie how many pages there are. It then seperates $fulltext into arrays with one page in each array. Am I wrong?
Secondly, how do I go from here to making the list of links?
I didnt really understand the bits later on in the thread.
Adolescent Adulthood - Learn All ABout Flirting, Dating And Dumping.
Bookmarks