Hi,
I searched through the site and found some posts relating to this, but none with answers.
I'm not very good at regex, but this is what I've come up with to get the Next and Previous page links with a title for the Next link.
The problem is that it only puts the first pagebreak code correctly into the array and then scatters bits of others in different parts of the array.
Can someone help me with the Regex to get the titles (preferable without the [PAGEBREAK title=' and '] bit) and also the Regex to get the title including spaces and any other characters in the title attribute.
Hope this makes sense.
Code:
$text = "Here is the first page.[PAGEBREAK title='Page2']Here's the second page, called erm..Page 2.[PAGEBREAK title='Page 3, with spaces and other characters.']Page 3, how boring...no title. Oh my god!";
if (!isset($page)) $page = 0;
eregi("([PAGEBREAK title=')+([a-zA-Z0-9])+']", $text, $titles);
print_r($titles);
$textarray = split("([PAGEBREAK title=')+([a-zA-Z0-9])+']", $text);
$text = $textarray[$page];
$nextpage = $page + 1;
if (trim($titles[$page-1]) != "") {
list($pb, $title, $blank) = split("'", $titles[$page-1]);
if (trim($title) == "") {
echo("<H3>Default Title</H3><P>");
} else {
echo("<H3>$title</H3><P>");
}
} else {
echo("<H3>Default Title</H3><P>");
}
echo("$text<P>");
Thanks a lot,
Jey Biddulph