Hi Tim,
Does your insertOne.php file contain dynamic PHP content, or is it just html code? If its just html code the easiest way to swap out the placeholder is like this:
$filterOn = '#insert_content#';
//Get the new content to display from a file
$new_content = file_get_contents('test.php');
//Add new content to content variable
$blogRecord['content'] = str_replace($filterOn, $new_content, $blogRecord['content']);
So the placeholder in this example is called #insert_content#, the content of test.php is stored as a string in the variable new_content. Then str_replace is used to swap the placeholder with the string of content from test.php.
If you have PHP code in insertOne that needs to be run on the page, I would recommend using this method instead:
$filterOn = '#insert_content#';
//Check if the string contains the filterOn placeholder, if it does store the num where it starts in a variable
if($startNum = strrpos( $blogRecord['content'] , $filterOn)){
//Display the first half of our content string before the placeholder
echo substr($blogRecord['content'],0,$startNum);
//Include our content from test.php
include('test.php');
//Display the second half of the content after the placeholder. Add the length of the placeholder to ensure the placeholder isn't displayed.
echo substr($blogRecord['content'],$startNum+(strlen($filterOn)));
}else{
//If the string doesn't contain our placeholder, display it like normal.
echo $blogRecord['content'];
}
So the above system first checks if the blog content contains the filter on variable, and number of digits into the string where it starts. It then displays the first half on the string before the placeholder. Then the content of test.php is included and then finally the second half of the content is displayed.
All of the above is just example code, so you might have to make a few changes to get it working with your pages.
Let me know if you have any questions.
Thanks!
Greg
Greg Thomas
PHP Programmer - interactivetools.com