homepage Welcome to WebmasterWorld Guest from 54.237.54.83
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Php include above Directory
mike2010




msg:4643720
 4:47 pm on Feb 9, 2014 (gmt 0)

I'm having a mental block currently.

forgetting how to do this..

<?php
include('linx.html');
?>


works.

but trying to include a file that's in a directory above it won't.

<?php
include('/new/linx.html');
?>


i've even tried the following extra without success either

<?php
include('./new/linx.html');
?>

<?php
include('../new/linx.html');
?>

<?php
include('new/linx.html');
?>

<?php
include('/var/www/vhosts/sitedomain/new/linx.html');
?>




:-(

 

mike2010




msg:4643721
 5:12 pm on Feb 9, 2014 (gmt 0)

I figured out an alternate route.

Next thing I need to do is make this php include file listen to the javascript around it, so that the file embeds within the borders specified within javascript. Otherwise the file just opens across the whole page.

If I can't accomplish this with mixing javascript along with php, i'm willing to accept an alternative.

Basically I just want to lower the width in which this file opens up to. Maybe <table> elements would be better?

brotherhood of LAN




msg:4643728
 6:03 pm on Feb 9, 2014 (gmt 0)

try "echo getcwd();exit(0);" just before the include to see that the current working directory is the one you expect it to be. Also turn error and warnings on to see what PHP says about it.

Jonesy




msg:4643737
 6:53 pm on Feb 9, 2014 (gmt 0)

The OP solution should be:

<?php
include('../linx.html');
?>

"Include 'linx.html' from the directory immediately above
the current directory ( '../' ).

. . . unless I'm reading the OP all wrong.
Jonesy

mike2010




msg:4643744
 8:26 pm on Feb 9, 2014 (gmt 0)

thx.

how about my part 2 in 2nd post ?

the problem now is, the file opens (include works) ...but it doesn't matter where I put the php include on the page, it just starts displaying near the top of the page, and outside of the boundaries I specify to to be cutoff to.

basically i'm opening this file (php include) into a small blog section, and I need it to open just there. (not all over the page)

it initially displayed in the proper area using Javascript

var iframesrc="/news/mysourcefile.htm"

but I need php include to take it's place. php seems to have a mind of it's own...takes over the whole top part of page.

penders




msg:4644618
 12:56 am on Feb 13, 2014 (gmt 0)

...but it doesn't matter where I put the php include on the page, it just starts displaying near the top of the page


Well, that is a bit tricky to debug without seeing the rest of your page, because the contents of the include are included wherever you have the include statement! (If that's not an overuse of the word "include" I don't know what is! ;)

Does the resulting HTML give any clues as to what's going wrong?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved