Click to See Complete Forum and Search --> : Including Files


Neczy
11-24-2004, 04:17 PM
How do you include files via php? Thanks :)

notaguru
11-24-2004, 04:30 PM
<? include ("/home/user/file.php"); ?>

You can include php or txt files.

Greets.

P.S., put the full path of the file for better results or just the name if it is on the same dir,

Daniel T
11-24-2004, 04:30 PM
include() (http://www.php.net/include) or require() (http://www.php.net/require)

EDIT
In reply to notaguru: Actually, you can include any type of file so long as it contains code that is interperatable by the server. Remember, PHP can only be parsed in files with PHP-parsing-extensions, defined by the server's php.ini file.

EDIT **
In reply to notaguru's PS: This is not the case. Specifing the full path will not necisarilly make for "better results", but will cause the PHP in the included file to be parsed before being included. However, using relative paths from the document root may not be a bad idea.

Neczy
11-24-2004, 05:34 PM
Thanks guys.