PDA

View Full Version : from JavaSript to PHP


DragonSoull
July 26th, 2002, 21:05
Can any body tell me what is the PHP code to replace this simple javascript?

<script language="JavaScript">
<!--
document.write(document.lastModified);
//-->
</script>

Mohd
July 26th, 2002, 22:15
please write the script down it doen't work for me. . .

ammoQ
July 27th, 2002, 06:41
replacing Javascript with PHP is a bit difficult - since Javascript is executed on the Client (Browser) and PHP on the Server, so the two can do different things.

DragonSoull
July 27th, 2002, 22:33
I'm Sorry. I can't belive i didn't noticed the code didn't show :confused:

this is the instruction i want to replace:

document.write(document.lastModified);

Jens Duttke
July 28th, 2002, 12:13
hi!

http://www.php.net/manual/en/function.getlastmod.php

Found that link in less than 20 seconds.

I wonder why you havn't searched that yourself.

Cu, JNS
---
http://www.emucheater.com
http://cyberpad.psxemu.com

ammoQ
July 28th, 2002, 16:20
I think it's not that easy. When the content is database-generated (that's why people use PHP), the date given by this function will change, only when the script is modified, but not when the database contains new data. So a bulletin board like this might say "last modified Feb 12th, 2002" althought people post new messages every day.

DragonSoull
July 28th, 2002, 16:50
Thanks, and no i didn't searsh by my self personaly i never manage to get any here by my self :P

Jens Duttke
July 28th, 2002, 17:33
hi!

Originally posted by ammoQ
I think it's not that easy. When the content is database-generated (that's why people use PHP), the date given by this function will change, only when the script is modified, but not when the database contains new data. So a bulletin board like this might say "last modified Feb 12th, 2002" althought people post new messages every day.

hmm ... that's true ... but doesn't the JavaScript code return only the last-modified date of the "script file" too ?

ammoQ
July 29th, 2002, 09:56
If the file is static, the JavaScript-solution would give the right answer. For a generated page, I donīt know what result it would give - probably not a usefull one.

DragonSoull
July 30th, 2002, 13:25
that's no problem just need the current file date for the file version
example: v 1.5 [ 12/07/2002 ]