how could we put a txt file content into html page ??
Printable View
how could we put a txt file content into html page ??
use the FileSystemObject in ASP...something like this
VB Code:
'index.asp <html> <body> <% Set fs = Server.CreateObject("Scripting.FileSystemObject") Set fileName = Server.MapPath("myFile.txt") If(fs.FileExists(filePath) then Set getInfo = fs.OpenTextFile(fileName, 1, False) If Not getInfo.AtEndOfStream then Do while Not getInfo.AtEndOfStream strLine = getInfo.ReadLine Response.write(strLine) Response.write("<br>") Loop End If Else Response.Write("File Does Not Exist") End If %>
there are different ways to do this...this is just one example.
or in PHP:
Code:<?php
$file = 'file/name.ext';
if (file_exists($file)) {
echo implode('', file($file));
}
?>
how could we do that even if i want the output apear in html page not asp or php
just html page the output
thank's
?
this outputs the included page as html page.
the inclusion is done by asp or php ... that's all
if you don't have php or asp you have to use shtml
or maby javascript
HTML is a markup language. You would have to use a scripting language or server-side includes (SSI through a .shtml file).Quote:
Originally posted by cgi
how could we do that even if i want the output apear in html page not asp or php
just html page the output
thank's
hi every body
thank's for replayes
but the answer is
<!--webbot bot="Include" U-Include="file.txt" TAG="BODY" -->
;)
^^^^ only works with frontpage bot things, i think only shows up in IE
Actually, I think it just needs the server to have Frontpage extenstions installed, or something.
It's not THE answer, it's AN answer. And we gave you others that were just as viable and also depended on something being installed on the server.
go with the PHP.
its easy to use, small, and its easy to write correlative scripts for it (to edit the text file from user input, etc).
and see how much code it took in ASP? psh....
PHP is easy to install on an Apache server, and free, so id go with that.