I am guessing that this is what you are refering to..
I'll be assuming you use [pagebreak]Title[/pagebreak] to break pages. You may adjust regexps if you wish...
To get the task done, you'll make each [pagebreak] somewhat like a header on each page, i.e. you'll split pages right before the pagebreak tags.
code:--------------------------------------------------------------------------------# Create a temporary token to ensure the pages split correctly
$articletext = eregi_replace('(\[pagebreak][^[]+\[/pagebreak])', '!!!TEMP-TOKEN!!!\\1', $articletext);
# Split on !!!TEMP-TOKEN!!!, leaving [pagebreak]s
$pagestemp = split('!!!TEMP-TOKEN!!!', $articletext);
# Add a title to the 1st page
$pagestemp[0] = '[pagebreak]Introduction[/pagebreak]' . $pagestemp[0];
--------------------------------------------------------------------------------
Now, to retrieve the title for a given page, use this code:
code:--------------------------------------------------------------------------------# Find the [pagebreak] tags and capture title inside them
eregi('\[pagebreak]([^[]+)\[/pagebreak]', $pagestemp[$pagenumber], $pagenametemp);
# Get captured title
$pagename = $pagenametemp[1];
--------------------------------------------------------------------------------
Substitute $pagenumber on the first line by the number of the page (start counting from 0). In particular, use a formula involving $pid to get next / prev pages...
Okay, i am really cofused, well here is my previous code:
Code:
if (!isset($page)) $page = 0;
$textarray=explode("[PAGEBREAK]",$text);
$text=$textarray[$page];
echo( "<font size='2'><P>$text</p></font>" );
// NEXT AND PREVIOUS PAGE LINKS
if ($page != 0) {
$prevpage = $page - 1;
echo("<A HREF=\"$PHP_SELF?aid=$aid&page=$prevpage\">".
"Previous Page</A> ");}
if ($page < count($textarray) - 1) {
$nextpage = $page + 1;
echo(" <A HREF=\"$PHP_SELF?aid=$aid&page=$nextpage\">".
"Next Page</A>");}
help greatly appreciated...
Bookmarks