|
Posted by Jerry Stuckle on 05/27/05 04:56
Steve wrote:
> For more clarification, you are obviously working on a Unix or Linux
> machine. If you are familiar with Windows, think of it this way:
>
> You are trying to open the file \layout\page_begin.php, which the
> system wouldn't be able to find. For the Windows machine, it would
> have to be the entire path, which would be
> c:\inetpub\wwwroot\site\layout\page_begin.pgp, or something similar.
> Your full path on your server just starts with your /home directory
> instead of c:\
>
> About including from http, Dave had it right when he said it doesn't do
> what you expect, but he didn't explain that. When you include a php
> file from a web address (http://some.site/some.file.php) the server
> executes that php file and sends you the output. So if the php file
> said:
>
> <?php
>
> echo '$title = "some title";';
>
> ?>
>
> Then the server would execute that line, and send the string '$title =
> "some title";' to the script requesting it. Since your include file
> probably didn't have any echo statements, no output was being sent and
> that's why it was blank. This is correct though, you don't want your
> php files outputting php code (generally), and so the correct way to
> include a file is without the http, you need to go through the local
> filesystem instead, which reads the actual code of the file as opposed
> to the output that it sends out.
>
Steve,
Actually, I am much more familiar with Windows machines. I've been
programming them since Dos 1.0 on the original IBM PC (did mainframes
for 15 years before that). I used the Unix example because that's what
the original question was about.
My example include works on ALL Apache servers. I use it regularly on
both my home test system (Windows) and my hosted accounts (on Linux). I
upload the files unchanged and they work fine.
Additionally - I generally have test machines as well as production
machines. Each machine, obviously, has its own root directory. I test
the files on a test machine. When I get them working, I just copy them
unchanged over to the production machine. On either Windows or Linux.
Also - yes, I know what happens when you include something via http.
But the original questioner had already figured that out, so I didn't
pursue the matter so as not to confuse him more.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|