View Full Version : Loading text file into HTML?
pininfarina
11-25-2007, 06:10 PM
I'm wondering if it's possible to load the text in a txt file directly into a div just by putting in the link to the txt file or something like that.
anyone know if that can be done?
pininfarina
11-25-2007, 06:14 PM
I believe I might need something like php to get this done, to bad I'm very limited in my php knowledge ( I can only implement code not think it up)
any help on that area?
laxman
11-25-2007, 08:38 PM
Yes, HTML cannot do this, you will need something like PHP. I know there are file read and write functions:
http://www.tizag.com/phpT/fileread.php
so check that out. Read the file into a variable, then just echo the variable where ever you want the text.
danlefeb
11-26-2007, 07:35 AM
bravo brings up a good point in that a standard .txt file doesn't have formatting. So importing it will just bring everything in one big clump of words. That means you'll want to format it...and if you're going to be formatting the text into HTML anyway, then you can do something simple like an iFrame and do away with the need for PHP or any server-side script.
pininfarina
11-26-2007, 05:13 PM
yes yes thnx for that one guys,
isn't it just possible to format whatever text is rendered out of that text file just using css styling on the div where the text is shown or rather where the php code is implemented?
pininfarina
11-27-2007, 07:11 PM
wow thanks so much bravo2zero, I'll implement this code asap