tags:

views:

93

answers:

6

In an enviroment where I can't use scripting language, and must use straight html, and I need to render the contents of a file in a webpage. Is there a way to do this? Or is a scripiting language required.

+3  A: 
<object type="text/plain" data="path/to/plain/text/file.txt">
    <p>Your browser must support the OBJECT element.</p>
</object>

That is the only effective way I can think of. IFRAMES/FRAMES work too, in a similar fashion.

Nick Presta
A: 

It's been a while since I've done straight HTML, but couldn't you use an <iframe> or <object> tag and point the src= attribute to the text file in question? Or is special rendering needed for the file?

Jweede
A: 

No, HTML can't do any dynamic scripting..

A: 

If the file just changes from time to time and its content format is appropriate you could re-write the web page using a server-side script at an appropriate interval and it can then be read by clients using standard HTML.

The server-side script need not be part of, or even known to the web server software (for example it could be a bash script or a standalone program run via a cron job).

mas
+1  A: 

If you just can't do PHP or anything similar, you could also try SSI, which I think is pretty standard: http://www.htmlgoodies.com/beyond/webmaster/article.php/3473341

Just curious; why can't you use a scripting language? Does the file reside on a local fileshare instead of a web server?

Even if you can't do any server-side scripting, you could probably use some JavaScript/AJAX to read the file and render it nicely: http://www.dynamicdrive.com/dynamicindex17/ajaxincludes.htm

Otherwise, the iframe suggestions others have posted should do what you need.

rob
A: 

Probably not very helpful but if your data is in XML file, you could always try XSLT?

lungic