I have an archive of txt files. I have an application that will bring up a menu listing those text files. When the user clicks on one of the links in their browser, it retrieves the txt file from the archive and displays it to the user. I would like to convert that txt file to html format, so when the user clicks on the link it brings up an html file, instead of the txt file. I have found numerous stand-alone applications that will convert txt to html, and vice versa, but am unable to locate any scripts that will accomplish this or similar. Looking for cgi, javascript, or asp. Any assistance is appreciated.
Have you looked into scripts that would use the txt file as an include? Whether asp, php or use of javascript there seem to be plenty of ways to perform the display of the txt wrapped within a file dynamically passing the txt file name as a parameter.
why don't you do something like: file.php?retrieve=thetextfile.txt <html> <head> <!-- PUT SOME METAS HERE IF YOU WANT --> <!-- Following we use the name of the file as title --> <title><? echo $retrieve ?> </title> </head> <body> <!-- and now we include the content of the text file in to the body --> <? include $retrieve; ?> </body> </html> Code (markup): Don't expect this to work, I really do not know about php, but its the main idea to work on it.
Thank you for your responses. Please let me clarify. I DO need to format the text. We already have an html page with an include. What we're trying to do is actually format the text into tables, tr's etc. I apologize for not including this info at first.
The reports are .txt files that include a title, and tables with 4-6 columns listing name of product, quantity, description, etc. I'm not sure if this is what you meant
if they are text files, they don't include tables... but it seems to me that you want php with a couple of file reading options readfile () returns the contents of the file file() returns an array with each new line of the file as an element of the array which can be useful explode( string separator, string string [, int limit] ) will take a string and break it into an array according to a string seperator.... useful for turning comma seperated files into arrays (I'm sure ASP would have equivalent functions)