-
September 1st, 2002, 03:32 AM
#1
Member
Include Files In PHP?
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,
-
September 1st, 2002, 03:37 AM
#2
yes its a function called include()
so u just at the top of the page usually put
include(filename.inc);
hope it helps rioter
-
September 1st, 2002, 03:41 AM
#3
Member
Thanks RiOtEr, i'm just checking now....
-
September 1st, 2002, 06:24 AM
#4
Member
does the file have to have an extention of '.inc'?
-
September 1st, 2002, 06:42 AM
#5
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.
-
September 1st, 2002, 11:58 AM
#6
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');
-
September 1st, 2002, 12:56 PM
#7
Hmm, does this execute all code in that file, or does it just make functions and variables available?
I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.
-
September 1st, 2002, 01:10 PM
#8
guus include makes them avalible require runs it least thats my understanding of it
rioter
-
September 1st, 2002, 11:39 PM
#9
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.
-
September 2nd, 2002, 01:04 AM
#10
If you need to see any errors form the include use
error_reporting(E_ALL);
at the top of the page....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|