Jump to content

Connecting 2 files


thewindmaker

Recommended Posts

Hi,I am using a ftp server right now but that besides the point.I was wondering if i make a php file with say a menu bar and all its coding and save it to the ftp folder. Can I use that file in part of all of my other pages but just linking it or something like that? So that I won't have to update each page seperatly to add a new link or something instead I could just update that one menu file?ThanksTWM

Link to comment
Share on other sites

That's right, you can include whatever file you want, and you can actually either use parentheses or not:include 'file.txt'; // Works.include ('file.php'); // Works.Check the page that skym linked to for more info.

Link to comment
Share on other sites

That's how it works. If there is a file called "file.php" in the same directory as the file with the include statement, then file.php will be included into the same scope and evaluated. If the file is in a different directory on the same server, make sure you specify the path. If the file is on a different server, you are not able to include PHP code, only HTML.Try using require instead of include and see what the error message says.You can get more information here:http://www.php.net/manual/en/function.include.php

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
×
×
  • Create New...