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


try {

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

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


	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.

} catch(DynamicPageException $dpe) {

	echo $dpe;



Return current item: Dynamic Page