ckrudelux Posted June 22, 2009 Share Posted June 22, 2009 if i have a file with some php code do I need to use these tags <?php , ?> then I include the file like this: <?phpinclude "file.php";?> file.php : echo "Text"; If I can, what is the down side with it or up side? Link to comment Share on other sites More sharing options...
smerny Posted June 22, 2009 Share Posted June 22, 2009 you have to have the include within the PHP tags or it wont be read as PHP code... not sure if thats all you were asking?includes are used when you have certain code you want to use on multiple pages... or when you want to use code from multiple pages without changing the main page you are on... otherwise you can just have all the php code on the main page and not include any other Link to comment Share on other sites More sharing options...
jlhaslip Posted June 22, 2009 Share Posted June 22, 2009 When you 'include' a file, the PHP parser assumes the file is an html file.In order to not parse the file as html, you need the php tags. Link to comment Share on other sites More sharing options...
ckrudelux Posted June 22, 2009 Author Share Posted June 22, 2009 When you 'include' a file, the PHP parser assumes the file is an html file.In order to not parse the file as html, you need the php tags.Thanks for the help. So you will get a cookie now. :)edit: "Hey I couldn't give you a cookie " Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.