Return to Help Center

Welcome to the Bravenet Help Forums. Here you can chat and meet other Bravenet Members. Please do not post advertisements.

Forum: Web Design Discussions
Start a New Topic 
  
Author
Comment
How to call a php file from a file within a folder.

Hi,

I have no problem calling html from an external php from my main website page (index.php) or from other files outside of folders. However, when I make a file within a folder, the same syntax does not work to call the same external php.

I am using the following syntax to call the php file:



When calling this same php file from a file within a folder, I have tried using the following, but it does not work:



What will work?

Re: How to call a php file from a file within a folder.

I noticed that my code is not showing up in my question. hmmm....

Re: How to call a php file from a file within a folder.

Code:

<!--?php include ('http://my_domain_name/includes/header.php');?-->


This was the line of code. All else being equal identical code should work from any html page in the root or any sub folder.

I suspect that there is a.n.other problem with the file in the folder. Upload the same file to both locations and check if they both work.

Re: How to call a php file from a file within a folder.

I found the answer not too long after I posted this. In case anyone else wants to know the answer to this question, this code works when trying to call a PHP file from a sub folder/file:

$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/includes/nav.php";
include($path);
?>

Of course you would need to change "/includes/nav.php" to whatever your folder/file name is that you are using.


And thank you to all who reached out to help.

Jennifer

Re: How to call a php file from a file within a folder.

Quote: Jennifer Williams
Hi,

I have no problem calling html from an external php from my main website page (index.php) or from other files outside of folders. However, when I make a file within a folder, the same syntax does not work to call the same external php.

I am using the following syntax to call the php file:



When calling this same php file from a file within a folder, I have tried using the following, but it does not work:



What will work?



For anyone wishing to view the code (hidden) just click "Quote" and the code will show.

Re: How to call a php file from a file within a folder.

Hey guys, recently i bought a DVD Ripper named can ps4 play dvd. I tried to convert some Chinese made DVDs but but it does not work. I do not know how to do with it since its is okay on Disney and Warner ones.

Re: How to call a php file from a file within a folder.

The data above is from the PHP documentation, the thing is there is not a right one, will rely on upon the require of the code, I do require on essential stuff like capacity, yet on subject Pay Someone To Write My Essay proceedings like subtitle or the circle I utilize include_once or add in on the grounds that i can deal with the notice and say to the client/guest that happens a blunder rather than only a fatal_error

Email