[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] PHP and include?

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?


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"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]