//result you can see here:
//http://members.lycos.co.uk/horobey/testlab/
pageexploder.php
<?PHP
error_reporting(53); // hate warnings!!
//this is not ready to use code just ideas:
$tag_begin = "<!--nextpage "; // notice spaces
$tag_end = " -->";
// supose text is already in in $str
// im sure filereading you can do on ur own
$str = "The very FIRST PAGE<!--nextpage Page2 -->Hey this page 2<!--nextpage Page3 -->Hey this page 3<!--nextpage Page4 -->Hey this page 4";
$arr=explode($tag_begin, $str);
foreach($arr as $key=>$val) echo("$key>$val<hr>");
//now array contains elements beggining with
// YourMenuName1-->Part of text
// YourMenuName2-->Part of text
//lets go through the array:
for($i=0;$i<sizeof($arr); $i++){
$pos1 = strpos($arr[$i], $tag_end);
if($pos1 !== false){ // !== not !=
$menu_names[$i] = substr($arr[$i],0,$pos1); // so we have menu name
$pos1 += strlen($tag_end);
$arr[$i] = substr($arr[$i],$pos1);
} else {
//notfound end tag "-->" do what you want
}
// so what we finally got?
echo("<br>$arr[$i]<hr>");
}
?>