Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Other Chat (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=12)
-   -   How to get a PHP file to be included in the files in different directories? (http://www.mysidiaadoptables.com/forum/showthread.php?t=1563)

robertson 09-21-2010 07:10 AM

How to get a PHP file to be included in the files in different directories?
 
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

RE: How to get a PHP file to be included in the files in different directories?
 
Something along the lines of
PHP Code:

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
Code:

http://websitename.com/directory/file.php

pumashoes34 10-28-2010 06:51 AM

RE: How to get a PHP file to be included in the files in different directories?
 
Quote:

Originally Posted by Killgore
Something along the lines of
PHP Code:

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
Code:

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

RE: How to get a PHP file to be included in the files in different directories?
 
Quote:

Originally Posted by pumashoes34
Quote:

Originally Posted by Killgore
Something along the lines of
PHP Code:

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
Code:

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

RE: How to get a PHP file to be included in the files in different directories?
 
Code:

<?php include('../yourdirectory/yourfile.php'); ?>
Don't use http:// or it'll mess up.


All times are GMT -5. The time now is 11:10 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.