Page 1 of 1

Reading in PHP and displaying

Posted: Wed Feb 15, 2006 2:26 pm
by AndrewBacca
Hey I have a big problem

I have a working templete system for my current project but what I want to do is read a php file in for it is displayed so I can replace some tags I.e <% FORM1 %> then display the fill PHP page.

now I have it replacing the tags put when it goes to display the page all I see is code and looking at the pages source via mozilla the <?php and the first few parts of the code are a pink colour

I am thinking its because I am turning it into a string but I am not sure here is my code so far.

Code: Select all

$phphtml  = "";
	if ($FH = fopen($page_url, 'r')){
		$phphtml = fread($FH, filesize($page_url));
		fclose($FH);
		
	}
	
	$phphtml = str_replace( "<% FORM1 %>", "blah", $phphtml );
	
	print $phphtml;

Posted: Wed Feb 15, 2006 2:47 pm
by feyd
eval() may be what you need, however, what you are trying to do doesn't really seem like the best way to do it. Why not pass the variables in?