PDA

View Full Version : How to get a PHP file to be included in the files in different directories?


robertson
09-21-2010, 07:10 AM
Currently I have created some web pages in PHP and moved to my hosting a server.It installed.With PHP 5.1.6 that I am able to include only the files that are in the same directory (which work well with require (). If this is not an error message to show some No such file in the directory appears on the page. Want to use them for inclusion in various direcetories.What I do?

Killgore
09-24-2010, 07:23 PM
Something along the lines of
include('the FULL url of the file you wish to include');
should work. You could also use the require() function as well.

Note: the full url you're looking for should be something like
http://websitename.com/directory/file.php

pumashoes34
10-28-2010, 06:51 AM
Something along the lines of
include('the FULL url of the file you wish to include');
should work. You could also use the require() function as well.

Note: the full url you're looking for should be something like
http://websitename.com/directory/file.php


The answer to your questions, however, is by using relative paths.

Do a quick search for: php includes relative paths

denverwed
11-09-2010, 06:58 AM
Something along the lines of
include('the FULL url of the file you wish to include');
should work. You could also use the require() function as well.

Note: the full url you're looking for should be something like
http://websitename.com/directory/file.php


The answer to your questions, however, is by using relative paths.

Do a quick search for: php includes relative paths



yes i agree with you .... give ralative paths in include function....

Derek M
11-09-2010, 10:20 AM
<?php include('../yourdirectory/yourfile.php'); ?>


Don't use http:// or it'll mess up.