Jump to content

Include


ckrudelux

Recommended Posts

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...