[K12OSN] PHP and include?

Scott Sherrill scott at remc1.org
Wed Oct 11 13:57:06 UTC 2006


Doug Simpson wrote:
> I want to be able to have a raw text file displayed in a certain spot on 
> a web page without a user having to edit the actual web page.
> 
> If I am thinking correctly, there is an include function on php that 
> will do this, but I need the syntax. Also, if possible, I need it to 
> pull the txt file from the users' public_html folder.

Is this what you are looking for Doug?

http://webservices.remc1.net/playground/

there are two files in that folder

one called test
and one called index.php

test just includes a copy/paste of your message

index.php is 5 lines:

<?
print "<pre>";
include "test";
print "</pre>";
?>

I added the pre tags so that it honored the carriage returns you added.

The text file could have been anywhere it did not need to be in the same 
directory.

Just specify the path to the file in the include:

include "/home/scott/pathtofile/test"


Scott




More information about the K12OSN mailing list