The Church Media Community
Equipping You to Communicate Effectively
support CMN & share a
library of 19K+ images, videos, etc
Go Pro!
 
Go Back   The Church Media Community > Website Design > Website Coding Discussions
Forgot Password?
                          Register

Website Coding Discussions PHP, MySQL, Java, Javascript, ASP, etc.

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old Tuesday, October 7th, 2008, 06:43 AM
Arlin's Avatar
Church Media Regular

 
 Join Date: Dec 2003 
 Last Online: Yesterday 
Java "document.lastModified" not working???

This is wierd...
I am using the following code snippet to show when a webpage was last updated..
BUT...
Instead of showing when it was last modified, it shows the current date/time!

I recently moved to a Godaddy shared host and added google analytics code. Before that, the code below worked fine.

Anyone have any suggestions?
Here is the website:
http://www.arcluverne.org/news/home.html


Code:
var m = "Page last updated " + document.lastModified; 
var p = m.length-0; //can remove time by changing 0 to 8
document.write(m.substring(p, 0));
Reply With Quote Start a New Topic From This Comment
  #2 (permalink)  
Old Tuesday, October 7th, 2008, 10:48 AM
greg4god's Avatar
Web Geek

 
 Join Date: Jun 2007 
 Last Online: Thursday, May 23rd, 2013 
If it worked before you moved to your new host, then you may want to contact them about it.

Without being able to see your setup and play with the server, I would think that it has to do with how the server actually feeds out your pages. (ie. takes your page and parses it out, so it is actually dynamically created, thus making a timestamp of whenever you call it.

Your hose should be able to advise you more.

-Greg
Reply With Quote Start a New Topic From This Comment
  #3 (permalink)  
Old Wednesday, October 8th, 2008, 11:02 AM
Arlin's Avatar
Church Media Regular

 
 Join Date: Dec 2003 
 Last Online: Yesterday 
Well it turns out that the issue is that the server is not including the lastmodified information in the HTTP header.
See this for an explanation: http://www.quirksmode.org/js/lastmod.html

I will try to work with Godaddy on this, but I doubt they are going to budge as this is a shared hosting account.

Any other suggestions on how I could accomplish the same thing?
Reply With Quote Start a New Topic From This Comment
  #4 (permalink)  
Old Thursday, October 9th, 2008, 09:38 PM
Tony Kanago's Avatar
'kuh'-'nay'-'goh'
Become a CMN Professional Member!

 
 Join Date: Nov 2004 
 Last Online: Sunday, September 19th, 2010 
You can only safely accomplish this using a server-side solution, such as PHP, ASP, Server Side Includes, or any number of similar options. In PHP, this would look like:

$modified = filemtime("filename");
echo "Modified on " . date("F dS Y - h:ia", $modified);
__________________
http://kanago.net - experiences in media
Reply With Quote Start a New Topic From This Comment
Reply

  The Church Media Community > Website Design > Website Coding Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:



Add to Google


Register Now for FREE!
Our records show you have not yet registered to our community. To sign up for your FREE account INSTANTLY fill out the form below!

Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Agree to forum rules 


All times are GMT -6. The time now is 01:47 PM.

   
 
© 1995-2008, ChurchMedia™, ChurchMedia LLC

SEO by vBSEO 3.1.0