Location: PHPKode > scripts > Dynamic Page > dynamic-page/exception_example6_special_case_index.php
<?php

require_once("dynamic_page.class.php");

try {

	$myPage = new DynamicPage("dynamic_page_test.html");

	echo "Before apply DynamicPage, comment tag <--user --> is hidden:</br>";

	$myPage->showPage();

	echo "After apply DynamicPage, comment tag <--user --> was replaced to new content:</br>";

	/**
	 * Exception #4 Special Case
	 * replaceInPage method calls with inexistent $target parameter in page
	 * This exception cause has a difficult diagnosis. The 3rd parameter was 
	 * not republishing in first call of replaceInPage method and target tag
	 * will be inexistent for a second call.
	 * Try $myPage->replaceInPage("user", "Marcos", true); for correct mode.
	 */
	$myPage->replaceInPage("user", "Marcos"); // input 'true' in the 3rd parameter to republishing the tag
 // $myPage->replaceInPage("user", "Marcos", true); // uncomment this for correct mode and comment preceding line
	$myPage->replaceInPage("user", " Bezerra");     // or omit that for not.
	$myPage->showPage();

} catch(DynamicPageException $dpe) {

	echo $dpe;

}

unset($myPage);

?>
Return current item: Dynamic Page