Click to See Complete Forum and Search --> : How to load newest page into a frame - help
GarMac
03-03-2003, 01:22 AM
How can I load the newest created page from a set folder into a frame. I need this to happen when the site is loaded, and as an option "Main Button" in the same frame?
HTML, Javascript????
Any help greatly appreciated.
khalidali63
03-03-2003, 01:25 AM
if I understand it correctly..
frame name="someName" src="testPage.html">
now you can creae testPage.html make changes to and so forth it will be loaded when ever this frame is loaded.
Khalid
GarMac
03-03-2003, 01:49 AM
This will be an online newspaper site. So each page will be saved to a folder.
Such folder groups as 2003
subfolder 4.15 (For April 15th)
And file located inside that folder would always be the pages named "news.html" "classified.html", "sports.html" etc.
The first 'index.html' page consists of two frames; indextop.html (and hopefully, the most current 'news.html' page available.)
Each "news.html" page no matter which dated folder it was in would be connected to the other pages on that level (sports, classified, etc) by buttons on the same lower frame.
Except that at the top of those grouped buttons is one that says "Main Button" to again hopefully pull up the most current news page (in the most current dated folder)
If it helps this needs to be set to a weekly paper.
I'm guessing that somehow I need to ask the browsers computer for the date, and use that value to compare to the dated folders that I have and to somehow open up into the lower frame the date that matches within the last seven days?
khalidali63
03-03-2003, 07:56 AM
Well here is what I have understood.
the code snippet below will get todays date and create a directory path with it.
<script type="text/javascript">
var date = new Date();
var year = date.getFullYear();
var month = (date.getMonth()+1);
var day = date.getDate();
var dirPath = year+"/"+month+"."+day+"/news.html"
//line below will print it only to show what
// its doing.Must delete it once not needed
document.write("file path = "+dirPath)
</script>
once you have the path then you only need toset the frames source
Frames have a src attribute it update its value on run time
and you are in the game.
One thing though,the weeekly magazine must have an issue date/or better yet like when the week starts for the mag..you will have to adopt the functionality that will compare the date part till that issue date..
Hope this helps
Khalid