Rave Radio: Offline (0/0)
Email: Password:
Page: 1Rating: Unrated [0]
Javascript Anyone?
Good [+1]Toggle ReplyLink» blah123 replied on Thu Jun 22, 2006 @ 5:17am
blah123
Coolness: 47555
Anyone know how to display the last modified date of an html document in another html document?
I'm using the following script:

But this only return the lastMod. date of the current document.
Any suggestions?
Good [+1]Toggle ReplyLink» flo replied on Thu Jun 22, 2006 @ 5:30am
flo
Coolness: 147010
document apparently refers to the current document... you need to open the other one and access it with a 'document2' variable, and the same snippet should work.
Good [+1]Toggle ReplyLink» blah123 replied on Thu Jun 22, 2006 @ 5:34am
blah123
Coolness: 47555
do you mean save the address of the other document as a string in the variable document2?
Good [+1]Toggle ReplyLink» flo replied on Thu Jun 22, 2006 @ 6:15am
flo
Coolness: 147010
saving it as a string is a way, but i think there are smarter means to access it, such as with a direct reference (ie kinda like a pointer), or maybe a 'HtmlDocument' or 'Document' object (if something like that exists).

i never really used javascript so i don't know what exactly you should use
Good [+1]Toggle ReplyLink» neoform replied on Thu Jun 22, 2006 @ 7:49am
neoform
Coolness: 340350
opening another file with javascript to do that is a bad way of doing it.. you're better off ditching the javascript way and doing it with php..
Good [+1]Toggle ReplyLink» blah123 replied on Thu Jun 22, 2006 @ 8:01am
blah123
Coolness: 47555
care to elaborate?
Good [+1]Toggle ReplyLink» moondancer replied on Thu Jun 22, 2006 @ 9:10am
moondancer
Coolness: 92950
She's not using a database though, that's the thing.

You can look into a windows API called ReadDirectoryChangesW. It has a few parameters containing file info from a directory you will specify(as the HANDLE), and then use the FILE_NOTIFY_CHANGE_LAST_WRITE command. See below. I know you don't really wanna use c++ but this script will be really small and simple, I can't think of anything else to use without a database .

BOOL ReadDirectoryChangesW( HANDLE hDirectory,
// handle to the directory to be watched

LPVOID lpBuffer,
// pointer to the buffer to receive the read results

DWORD nBufferLength,
// length of lpBuffer

BOOL bWatchSubtree,
// flag for monitoring directory or directory tree

DWORD dwNotifyFilter,
// filter conditions to watch for

LPDWORD lpBytesReturned,
// number of bytes returned

LPOVERLAPPED lpOverlapped,
// pointer to structure needed for overlapped I/O

LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
// pointer to completion routine

);


parameters
hDirectory
Identifies the directory to be watched. This directory must be opened with the FILE_LIST_DIRECTORY access right.

lpBuffer
Specifies the address of the formatted buffer in which the read results are to be returned. The structure of this buffer is defined by the FILE_NOTIFY_INFORMATION structure. This buffer is filled either synchronously or asynchronously, depending on how the directory is opened and what value is given to the lpOverlapped parameter. For more information, see the Remarks section.

nBufferLength
Specifies the length of the buffer pointed to by the lpBuffer parameter.

bWatchSubtree
Specifies whether the ReadDirectoryChangesW function will monitor the directory or the directory tree. If TRUE is specified, the function monitors the directory tree rooted at the specified directory. If FALSE is specified, the function monitors only the directory specified by the hDirectory parameter.

dwNotifyFilter
Specifies filter criteria the function checks to determine if the wait operation has completed. This parameter can be one or more of the following values: Value
Meaning

FILE_NOTIFY_CHANGE_FILE_NAME
Any filename change in the watched directory or subtree causes a change notification wait operation to return. Changes include renaming, creating, or deleting a file.

FILE_NOTIFY_CHANGE_DIR_NAME
Any directory-name change in the watched directory or subtree causes a change notification wait operation to return. Changes include creating or deleting a directory.

FILE_NOTIFY_CHANGE_ATTRIBUTES
Any attribute change in the watched directory or subtree causes a change notification wait operation to return.

FILE_NOTIFY_CHANGE_SIZE
Any file-size change in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change in file size only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed.

FILE_NOTIFY_CHANGE_LAST_WRITE
Any change to the last write-time of files in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change to the last write-time only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed.

FILE_NOTIFY_CHANGE_LAST_ACCESS
Any change to the last access time of files in the watched directory or subtree causes a change notification wait operation to return.

FILE_NOTIFY_CHANGE_CREATION
Any change to the creation time of files in the watched directory or subtree causes a change notification wait operation to return.

FILE_NOTIFY_CHANGE_SECURITY
Any security-descriptor change in the watched directory or subtree causes a change notification wait operation to return.


lpBytesReturned
For synchronous calls, this parameter specifies the number of bytes transferred into the lpBuffer parameter. For asynchronous calls, this parameter is undefined. You must use an asynchronous notification technique to retrieve the number of bytes transferred.

lpOverlapped
Points to an OVERLAPPED structure that supplies data to be used during asynchronous operation. Otherwise, this value is NULL. The Offset and OffsetHigh members of this structure are not used.

lpCompletionRoutine
Points to a completion routine to be called when the operation has been completed and the calling thread is in an alertable wait state. For more information about this completion routine, see FileIOCompletionRoutine.
Good [+1]Toggle ReplyLink» moondancer replied on Thu Jun 22, 2006 @ 9:14am
moondancer
Coolness: 92950
declaration,

BOOL ReadDirectoryChangesW(
HANDLE hDirectory,
LPVOID lpBuffer,
DWORD nBufferLength,
BOOL bWatchSubtree,
DWORD dwNotifyFilter,
LPDWORD lpBytesReturned,
LPOVERLAPPED lpOverlapped,
LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);

hdirectory=c://bla/bla
dwNotifyFilter=FILE_NOTIFY_CHANGE_FILE_NAME
Good [+1]Toggle ReplyLink» neoform replied on Thu Jun 22, 2006 @ 12:59pm
neoform
Coolness: 340350
Umm, javascript is a web based language.. you're talking about C++ here.. totally off base.

eva, is the site you're using running off of a server with php installed, or is it on your computer at home?
Good [+1]Toggle ReplyLink» moondancer replied on Thu Jun 22, 2006 @ 1:24pm
moondancer
Coolness: 92950
she's trying to get the last updated file from a server directory without using a database, it's not off base.
Good [+1]Toggle ReplyLink» moondancer replied on Thu Jun 22, 2006 @ 1:26pm
moondancer
Coolness: 92950
and a lot of people use c++ for background script on their webpages which is exactly what this is.
Good [+1]Toggle ReplyLink» neoform replied on Thu Jun 22, 2006 @ 2:14pm
neoform
Coolness: 340350
find a webhost that supports cgi scripts using C++ and i will then agree with you.

anyway, with php you can do it really easily.

[ ca3.php.net ]
Good [+1]Toggle ReplyLink» blah123 replied on Mon Jun 26, 2006 @ 6:53am
blah123
Coolness: 47555
neoform:php isn't installed, but i think i found a way to do it. Thanks 4 the suggestions everyone.
Good [+1]Toggle ReplyLink» Nuclear replied on Mon Jun 26, 2006 @ 3:16pm
nuclear
Coolness: 2749325
well if you found a way you should post it...
Good [+1]Toggle ReplyLink» moondancer replied on Tue Jun 27, 2006 @ 8:56am
moondancer
Coolness: 92950
yeah, post it.
Good [+1]Toggle ReplyLink» blah123 replied on Tue Jun 27, 2006 @ 1:31pm
blah123
Coolness: 47555
lol,
ok well the file is on a unix server,
so i wrote a short script to upload the file to the web, and added the simple command:
touch -filename
which updates the modification time of the file to the current time, this way, the file shows the same modification time as the file which i ACTUALLY want to give the last modified time of. (Since this script is automatically run whenever that other file is modified and uploaded to the net)
Javascript Anyone?
Page: 1
Post A Reply
You must be logged in to post a reply.