Re: 'nested conditional' that can identify parent page?
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Mon, 14 May 2007 10:50:46 -0400
Alan Jones wrote:
On Sun, 13 May 2007 09:41:17 -0500, Jerry Stuckle
<jstucklex@xxxxxxxxxxxxx> wrote:
Alan,
$_SERVER['REQUEST_URI'] does give the uri used to fetch the page. I'm not sure what you mean by 'child' file. Are you using frames? Maybe if you post the code you're using (including that in the 'parent' and 'child' pages) it will be more clear.
Thanks for helping me. :)
To isolate the process, I have recreated the scenario using new
files, file names, and a new folder called 'test'.
http://jalanjones.com/index2.php
: Inside of index2.php is...
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head><body>
<p>This sentence is in the index2.php file.</p>
<p><?php include('http://jalanjones.com/test/content.php');?></p>
<p>Why is there a numeral one (1) at the end? (scratching
head)<br><br></p>
</body></html>
: ...and inside of /test/content.php is...
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head><body>
<table cellpadding="10" style="border:1px solid #333333"><tr><td>
<p><br>This table is in the content.php 'include' file.</p>
<p>REQUEST_URI result: <b>
<?php echo($_SERVER['REQUEST_URI']);?></b></p>
<p>The result (/test/content.php) is the name of the include/child
file, not the parent page; the URL.</p>
<p>Below is phpinfo() run from inside the include file. Please see
the PHP Variables section...<br><br></p>
<?php echo phpinfo();?>
</table></tr></td>
</body></html>
Can anyone identify the culprit? Again, I am very new to PHP so it
is probably something only a clueless newb would do. :D
And as Schraalhans indicated, commands which relate to the underlying filesystem (i.e. link, fopen, include, etc.) reference the file system directly. So if you use absolute paths (beginning with '/'), it is the root directory of the file system. But your host has limited you so all you can access are files in /hom/httpd/vhosts/jalanjones.com/httpdocs and /tmp.
Thanks, I hope to avoid using link().
This is working normally. When you said:
<?php include('http://jalanjones.com/test/content.php');?>
This resulted in another call to the server to fetch test/content.php. So the URL in there will be "test/content.php". The only difference here is you included it from the server side instead of the client side - but when the http: request reaches the server, the server neither knows nor cares about the origin. The PHP file is executed and the results returned to index2.php, where they are displayed.
Now, if you would have instead done something like:
<?php include($_SERVER['DOCUMENT_ROOT'] . '/test/content.php');?>
This would have gone directly to the file system and included the file without an additional call to Apache. The file would have been included, the code executed and the results displayed.
Do you see the difference between the two?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- Re: 'nested conditional' that can identify parent page?
- From: Alan Jones
- Re: 'nested conditional' that can identify parent page?
- References:
- 'nested conditional' that can identify parent page?
- From: Alan Jones
- Re: 'nested conditional' that can identify parent page?
- From: ZeldorBlat
- Re: 'nested conditional' that can identify parent page?
- From: Alan Jones
- Re: 'nested conditional' that can identify parent page?
- From: ZeldorBlat
- Re: 'nested conditional' that can identify parent page?
- From: Alan Jones
- Re: 'nested conditional' that can identify parent page?
- From: ZeldorBlat
- Re: 'nested conditional' that can identify parent page?
- From: Alan Jones
- Re: 'nested conditional' that can identify parent page?
- From: Jerry Stuckle
- Re: 'nested conditional' that can identify parent page?
- From: Alan Jones
- 'nested conditional' that can identify parent page?
- Prev by Date: Re: Getting results from MySQL Database in PHP
- Next by Date: Re: Apostrophe - when used it mucks with my odbc
- Previous by thread: Re: 'nested conditional' that can identify parent page?
- Next by thread: Re: 'nested conditional' that can identify parent page?
- Index(es):
Relevant Pages
|