Forum Moderators: open

Message Too Old, No Replies

Searching for "On this Day" script

         

Storyman

11:50 pm on Mar 3, 2005 (gmt 0)

10+ Year Member



Anyone know of a "On this Day" script that uses a text file to store the data. Maybe I've been using the wrong search terms, but haven't been able to locate anything.

orion_rus

8:02 am on Mar 4, 2005 (gmt 0)

10+ Year Member



Of cause you didn't find anything in a Javascript because it's not reasonoble to right it on this language.
Then u load javascript you load all contents, and then filter only which u needed. On this day have very many items and i think js with it should have about ~1 Mb minimum size) nobody want's to load it. I think this scripts writing with server side languages like php,pearl or aspx. Try find there
Good luck to you

Storyman

8:25 am on Mar 4, 2005 (gmt 0)

10+ Year Member



If SS could be used, I'd be using PHP. Can't agree with your estimation regarding file size. The events are only a few lines of text.

What I've figured out so far is to create a .js page for each month and then create an array for each day of that month. The javascript gets the current day/month, then calls the appropriate month. Once the month page has been called it then checks the day and pulls that text.

Although I get the gist of how it works, I'd still prefer to find something to modify since my experience with javascript is limited.

You make a good point about using SS instead of javascript. If this weren't being used in an ebook I'd stick with PHP/MySQL.

orion_rus

11:31 am on Mar 4, 2005 (gmt 0)

10+ Year Member



Ok let's calculate
You have 365 days, in each day an average number of events is 5-7 i think. Each event is about ~50 symbols
it's about 100kb, not modifing script. If you would change it user should every time reload it. 100kB like a great image. You force to user download 100Kb for 250~300 symbols in it (only stories symbols, also you would have a javascript symbols and so on)
I think nobody will create a 100Kb code for 300 symbols in it

jalarie

2:36 pm on Mar 4, 2005 (gmt 0)

10+ Year Member



How about this:

OnToday=new Array(
'2005-03-01,march 1st',
'2005-03-04,today #1',
'2005-03-05,tomorrow',
'2005-03-04,today #2',
''
);
Now=new Date();
Now_M=Now.getMonth()*1+1; // Jan-Dec = 1-12
Now_D=Now.getDate(); // 1-31
Now_Y=Now.getYear();
if (Now_Y < 70) { Now_Y=Now_Y*1+2000; }
if (Now_Y < 1900) { Now_Y=Now_Y*1+1900; }
if (Now_M < 10) { Now_M='0'+Now_M; } // leading zero?
if (Now_D < 10) { Now_D='0'+Now_D; }
Today=''+Now_Y+'-'+Now_M+'-'+Now_D;
for (i=0; i<OnToday.length; i++) {
Item=OnToday[i];
ItemDate=Item.substring(0,10);
ItemRest=Item.substring(11);
if (ItemDate == Today) {
document.write(ItemRest+'<br \/>\n');
}
}

orion_rus

3:27 pm on Mar 4, 2005 (gmt 0)

10+ Year Member



i think new Data() gives a date which set in a client computer, if his clocks is wrong he gets a events what not connected with todays real date.
Best realization of this would be only on server side languages it's 100%

Bernard Marx

5:25 pm on Mar 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. How many people have computer clocks that are that far off reality?
2. How many such people - who take so little care of their clock, for instance - would give two hoots about getting the wrong 'on this day' message?

Storyman

10:05 pm on Mar 4, 2005 (gmt 0)

10+ Year Member



The calculations for download are right on and that is why under normal conditions, I'd be using PHP/MySQL. This is being used in an ebook, which means once it is downloaded there is no addition bandwidth. Also, the file is zipped, which reduces initial download too.

Frankly, I hadn't considered the reason for the lack of 'on this day' javascripts to be file size related, but it does make sense.

Bernard Marx

12:53 am on Mar 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What kind of ebook? CHM?

Storyman

1:07 am on Mar 5, 2005 (gmt 0)

10+ Year Member



I use Activ e-Book. Reasonably priced.