Jump to content

Include


ckrudelux
 Share

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?

Edited by ckrudelux
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.
Thanks for the help. So you will get a cookie now. :)edit: "Hey I couldn't give you a cookie :)" Edited by ckrudelux
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...