Click to See Complete Forum and Search --> : Read text.txt file and display


SamJ
08-01-2004, 03:11 PM
Been using HTML a long time but never formally. Recently installed a java applet that scrols text from a short text.txt file. But, now we just want a static display of that same text. Is this pretty basic?

Sam

Sam
08-01-2004, 04:16 PM
you'll need a server side language of some sort. Here's how you'd do it in php:
<?php include("text.txt");?>

SamJ
08-01-2004, 04:30 PM
I am somewhat familiar with ASP. I was able to get the text read and equal to an asp variable strReturned... real hacking... but forgot or do not know how to display it on my page.

<%
dim fsoObject
dim tsObject
dim strReturned
const constForReading = 1
const constTristateFalse = 0
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
Set tsObject = fsoObject.OpenTextFile("d:\scollettedesign.com\_websites\richsoil\richOilX.txt", constForReading, constTristateFalse)
Do While Not tsObject.AtEndOfLine
strReturned = strReturned & tsObject.Read(1)
Loop

response.write time
response.write strReturned

%>

Ben Rogers
08-02-2004, 12:43 AM
If it's just a bit of text, why not just move it to the place where it'd be...?

Fang
08-02-2004, 12:59 AM
<iframe src="mytext.txt"></iframe>

Sam
08-02-2004, 02:12 AM
ewww! no! Why would you use an iframe if you have a server side language available? here's the ASP for an include:
<!--#include file="text.txt"-->
for more info, the w3schools (http://www.w3schools.com/asp/asp_incfiles.asp) has some good info on them.

Fang
08-02-2004, 06:47 AM
iframe is a html solution, this is the html forum.