Click to See Complete Forum and Search --> : PHP Includes


krys
05-24-2003, 06:38 PM
I am having trouble with PHP Includes. For some reason they wont work. I've tried different tuts but none seem to work or i just don't get it. Can anyone help me?

they're suppose to be easy.. no? lol

Nevermore
05-25-2003, 04:03 AM
What exactly are you trying to do? To include a file, just rename the page to .php and put this code in it: <?php include("FileToInclude.whatever"); ?>. The file you want to include can have any extension.

krys
05-25-2003, 02:45 PM
im trying to include a menu to my pages... so when I update it, I dont have to edit every page.

Nevermore
05-26-2003, 03:28 AM
OK. here's how to do it:
1) Put this code in the page you want to include the menu in:
include_once("pagetoinclude.htm")
(Changing the filename in the parantheses)

2)Put the menu in the same directory as the file it's being included in.

3)See if it works - note that it will have to be run on a PHP-enabled server to work.

4)Post again if it doesn't!

krys
05-26-2003, 10:41 AM
It worked. Thanks :]