Reading in PHP and displaying

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
AndrewBacca
Forum Commoner
Posts: 62
Joined: Thu Jan 30, 2003 10:03 am
Location: Isle of Wight, UK

Reading in PHP and displaying

Post 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;
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
Post Reply