Hello and thank you in advance for your time!
I am building a page that will display a file in an iframe.
The problem is that the files won't necessarily be static.
We are collecting weather data at 1 min. intervals which is saved into a flat file. I will be uploading these files (and re-uploading at set intervals) into a set directory with a naming scheme of Feb12log.* (type of file doesn't really matter. could be .txt, .csv, .xls) but the name will change corresponding with the month & year: {MMM}{DD}log.{ext}. Each month, a new file is created
I can successfully pull a file into an iframe. I can build a drop box and a static list of files (File1, File2, File3 etc). I am pretty sure that I can build a search box in the page that will parse the information in the iframe (Ctrl+F would work as well I guess). Hopefully this is enough background info.
Instead of building a page for each new month ad nauseam, I would love to be able to pull a list of files currently in the upload directory into a dropdown box and when a file is selected, have it display in an iframe on the same page. The ability to be able to search the page would be awesome.
So I can pull a drop down from an array:
And I have figured out how to pull multiple links into a target iFrame:Code:<script language="javascript"> function optionSel(selectbox,text,value ) { var optn = document.createElement("OPTION"); optn.text = text; optn.value = value; selectbox.options.add(optn); } function Option_list(selectbox){ var month = new Array("Jan12","Feb12","Mar12","Apr12","May12","Jun12","Jul12","Aug12","Sep12","Oct12","Nov12","Dec12"); for (var i=0; i < month.length;++i){ optionSel(document.drop_list.Month_list, month[i], month[i]); } } </script> </head> <body onLoad="Option_list()";> <FORM name="drop_list" action="yourpage.php" method="POST" > <SELECT NAME="Month_list"> <Option value="" >Month list</option> </SELECT> </form> </body>
Does anyone have an idea for code for a recursive search that can read a directory into an array? It could be a server side script.Code:<html> <head> <TITLE>Site Current Month Totals</TITLE> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </HEAD> <TABLE ALIGN=Left BORDER=1 BGCOLOR="#80FF00"> <TR> <TD><H4>Monthly Totals</H4> <UL> <LI><A HREF="Jan12log.txt" TARGET="DisplayWindow">Document 1</A> <LI><A HREF="Feb12log.txt" TARGET="DisplayWindow">Document 2</A> <LI><A HREF="Mar12log.txt" TARGET="DisplayWindow">Document 3</A> </UL> <IFRAME SRC="VerCurMonth.htm" NAME="DisplayWindow" WIDTH=1024 HEIGHT=480> </IFRAME></TD> </TR></TABLE> </BODY> </HTML>
If I can figure that out, and figure how to tie it all together, the only thing left is to format the directory list as links and it should be good.
Thoughts?
I am not looking for a handout, and I appreciate any input at all. My questions are: 1. Is this possible? Or should I resign myself to manually creating new pages every month? 2. Would anyone be able give me a nudge in the correct direction?
Thanks again!
M


Reply With Quote

Bookmarks