View Single Post
Old 10-28-2007, 12:01 AM   #3 (permalink)
Dorza
The Wanderer
 
Join Date: Sep 2007
Location: Wales - UK
Posts: 8
Thanks: 0
Dorza is on a distinguished road
Default

Thanks for your suggestion, it gave me an idea. It's weird how one can spend days trying to figure something out and they think they have exhausted all options that their skill will allow for, but then you read a suggestion on the net, which gives you an idea which is simplistic in nature to implement and then you think of your self as a muppet for not being able to think the solution up previously....

PHP Code:
$pNum 1;
$arrayNum 0;
$pageUrl "http://$RootUrl/some_dir/some_scirpt.php?ArticleId=$aId&page=";

//BELOW: $body is the relevant content from the db
$explode explode("[NEWPAGE]"$body);
$pageCount count($explode) -1;

preg_match_all("/<h5>(.*)<\/h5>/U"$body$fnd_titles);
$numTitles count($fnd_titles[1]) - 1;

// echo form tag

echo "<select name=\"pageNav\"> \n";

while(
$arrayNum <= $numTitles)
{
   while(
$pNum <= $pageCount)
   {
     echo 
"<option value=\"$pageUrl"."$pNum\">".$fnd_titles[1][$arrayNum]."</option>\n";
     
$pNum++;
     
$arrayNum++;
    }
}

echo 
"</select>\n";

//echo form submit button
//echo form close tag 
Not sure if the above works after tweaking things a bit after moving it from my editor, but on the site it works; needs some refining but I'm pointed in the right direction with it. As far as my code is concerned how should it be tided up and streamlined? I also still have that issue with [NEWPAGE] and wanting to use <h5></h5> instead.
Dorza is offline  
Reply With Quote