Hello, you can use, both the two instructions, include or require in php, they to the same, but in different way.
You should use require_once in php, when the included file should be included, by the php parser engine, only one time while a script or program is parsed.
Use the php include instruction, as in your case, in any others situations (html files maybe).
You can see many easy examples at php.net php online manual for the include/require that are very well explained:
http://php.net/manual/en/function.include.php
by the way if you like to include files that resides in differents directories, you can use, for example code like this (the include using relative path):
PHP Code:<?php
include('./dir/otherDir/index.php');
?>The include() construct will emit a warning if it cannot find a file; this is different behavior from require(), which will emit a fatal error.




Reply With Quote

Bookmarks