Hello my nerdy amegos ;),
Is there a method of putting include files in PHP. For example, in ASP they do it like this :: <!- #include file="thepage.asp" ->.
Any help would be appriciated.
Thanks,
Printable View
Hello my nerdy amegos ;),
Is there a method of putting include files in PHP. For example, in ASP they do it like this :: <!- #include file="thepage.asp" ->.
Any help would be appriciated.
Thanks,
yes its a function called include()
so u just at the top of the page usually put
include(filename.inc);
hope it helps rioter
Thanks RiOtEr, i'm just checking now....
does the file have to have an extention of '.inc'?
No, you can have any extension you want, .inc is just a good idea to keep yourself organized. You may also want to use the require() fuction, which for something can work better and can be more suited to your needs than include() can.
You can also use require_once('file.inc');
or require_once('file.php');
Options:
include('file.php/inc');
require('file.php/inc');
require_once('file.php/inc');
Hmm, does this execute all code in that file, or does it just make functions and variables available?
guus include makes them avalible require runs it least thats my understanding of it
rioter
They both do the same thing, but the difference is that include will include whatever you want in the page and if there is an error it will continue loading the page. However require will stop the page from loading if there is an error. As for require and include once, they are usually used for files that you want to make sure aren't loaded multiple times, it is also helpful because it can keep you from making a mistake. Hope dis helps.
If you need to see any errors form the include use
error_reporting(E_ALL);
at the top of the page....