How to include URL or file in PHP codes
Posted by on 09 May 2013 10:40 PM
|
|
There are 2 scenarios here: 1. To include a PHP file inside hosting space: eg: Document root: /home/user/public_html/ Index page: /home/user/public_html/index.php header to be included: /home/user/public_html/include/header.php Here you can use relative path in index.php: <? include "./include/header.php"; ?> 2. To include a URL in PHP codes: eg: If the PHP page to be included is an external URL, you would need to enable allow_url_include in PHP.INI. Do note that allowing allow_url_include is a security risk and this is not enabled by default on our shared servers. See http://blog.arvixe.com/setting-custom-php-ini-files-for-your-website/ to see the steps to enable custom php.ini (set allow_url_include to "On" there). allow_url_include only needs to be enabled if it is an external URL and you need to include that in your codes. | |
|
On my previous host, I used the "include" command on each Web page so that when navbar.htm was updated, I only had to post it once. This is not working on the Arvixe host.
I saw the two articles in the knowledge base, and using that suggestion did not work either.
I want to place the navbar.htm in a directory named "includes", then be able to call it up on all of the Web pages.
My web site is "fos.bike".
Thanks for any help that you can provide.
Please reach out to our support department so that way we can take a closer look at this. It's hard to comment with the limited amount of details.