faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 12 people (8%) answered Yes
Recently 0 of 10 people (0%) answered Yes

Entry

How do you include virtual paths in PHP, ASP has <!-- include virutal="/inc/file.asp" -->

Mar 24th, 2008 20:36
ha mo, Jason Benson, Glen Boonzaier,


To include a page in php use the require() or include() statements
Example:  
<? require("myscript.php");
//rest of your code etc
?> 
Above would include the file "myscript.php" within your script.  If the 
file "myscript.php" was not found you would receive a fatal error.  If 
you wished to have the script continue regardless of whether the file 
could be found and included, use the function include(); (identical 
functionality, different error handling)
See: http://us3.php.net/manual/en/function.require.php
and: http://us3.php.net/manual/en/function.include.php
hope that helps!
JB
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.templatestemp.com