How do I display the contents of a text file as an HTML page ..?
The text file has an ever changing content as visitors come and go from my website – it is the content of this login page I would like to display as an HTML page..
@NogDogDec 09.2005 — #If PHP is available on your host it just takes one line of code: [code=php] <?php ##### BE SURE TO NAME THIS FILE WITH A .php SUFFIX ##### ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang='en'> <head> <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'> <title>Include example</title> <style type="text/css"> <!-- #text { /* add desired styling for the included text here */ } --> </style> </head> <body> <h1>Include example</h1> <p id="text"> <?php echo(nl2br(htmlentities(file_get_contents("/path/to/file.txt")))); ?> </p> </body> </html> [/code]
@TheBearMayDec 09.2005 — #pre tags are now deprecated.[/QUOTE] As of ??? I see where the width attribute for <pre> has been deprecated as of HTML 4.01 http://www.w3.org/TR/html401/struct/text.html#h-9.3.4 but see nothing in it or the XHTML specs that alludes to the element itself being deprecated.