This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Dreamweaver > February 2006 > trying to add a ssi time clock
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
trying to add a ssi time clock
|
|
| skowhegan 2006-02-12, 6:37 pm |
| I am just trying to add this clock to a page. I have the ssi added but cannot
make the javascript work. I get the clock on the page but i cannot get it to
tick.
http://www.msad54.org/smithfield/test.shtml
<script type="text/javascript">
// Current Server Time script (SSI or PHP)- By JavaScriptKit.com
(http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit-
http://www.javascriptkit.com/
// This notice must stay intact for use.
//Depending on whether your page supports SSI (.shtml) or PHP (.php),
UNCOMMENT the line below your page supports and COMMENT the one it does not:
//Default is that SSI method is uncommented, and PHP is commented:
var currenttime = '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo
var="DATE_LOCAL" -->' //SSI method of getting server date
//var currenttime = '<? print date("F d, Y H:i:s", time())?>' //PHP method of
getting server date
///////////Stop editting here/////////////////////////////////
var montharray=new
Array("January","February","March","April","May","June","July","August","Septemb
er","October","November","December")
var serverdate=new Date(currenttime)
function padlength(what){
var output=(what.toString().length==1)? "0"+what : what
return output
}
function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1)
var datestring=montharray+" "+padlength(serverdate.getDate())+",
"+serverdate.getFullYear()
var
timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes(
))+":"+padlength(serverdate.getSeconds())
document.getElementById("servertime").innerHTML=datestring+" "+timestring
}
window.onload=function(){
setInterval("displaytime()", 1000)
}
</script>
<p><b>Current Server Time:</b> <span id="servertime"></span></p>
<p style="font: normal 11px Arial">This free script provided by<br />
<a href="http://www.javascriptkit.com">JavaScript Kit</a></p>
| |
| Joe Makowiec 2006-02-12, 6:37 pm |
| On 09 Feb 2006 in macromedia.dreamweaver, skowhegan wrote:
> I am just trying to add this clock to a page. I have the ssi added
> but cannot make the javascript work. I get the clock on the page but
> i cannot get it to tick.
> http://www.msad54.org/smithfield/test.shtml
For some reason, this portion of the script is not appearing on your
page:
> <script type="text/javascript">
>
> // Current Server Time script (SSI or PHP)- By JavaScriptKit.com
> (http://www.javascriptkit.com)
> // For this and over 400+ free scripts, visit JavaScript Kit-
> http://www.javascriptkit.com/
> // This notice must stay intact for use.
>
> //Depending on whether your page supports SSI (.shtml) or PHP
> (.php),
> UNCOMMENT the line below your page supports and COMMENT the one it
> does not:
> //Default is that SSI method is uncommented, and PHP is commented:
>
> var currenttime = '<!--#config timefmt="%B %d, %Y
> %H:%M:%S"--><!--#echo
> var="DATE_LOCAL" -->' //SSI method of getting server date
> //var currenttime = '<? print date("F d, Y H:i:s", time())?>' //PHP
> method of
> getting server date
>
> ///////////Stop editting here/////////////////////////////////
I checked the javascript console (enter "java script:", without the
quotes, into your browser's address bar), and it reports that:
Error: currenttime is not defined
Source File: http://www.msad54.org/smithfield/test.shtml
Line: 8
--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
| |
|
|
|
| The page you currently have up there needs to have a *.php ending. The
script you're server side including is a PHP script - so it will need to be
named test.php to work.
"skowhegan" <webforumsuser@macromedia.com> wrote in message
news:dsfliv$tc$1@forums.macromedia.com...
> If I put all that in the code that I come up with this
>
> http://www.msad54.org/smithfield/test.shtml
>
> Very confused.
>
> Nancy
| |
| Murray *TMM* 2006-02-12, 6:37 pm |
| Hmm - I wonder if the server supports PHP? 8)
--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"crash" <crash@bcdcdigital.com> wrote in message
news:dsftqm$cmt$1@forums.macromedia.com...
> The page you currently have up there needs to have a *.php ending. The
> script you're server side including is a PHP script - so it will need to
> be named test.php to work.
> "skowhegan" <webforumsuser@macromedia.com> wrote in message
> news:dsfliv$tc$1@forums.macromedia.com...
>
>
| |
| Murray *TMM* 2006-02-12, 6:37 pm |
| I just saying.... 8)
--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"Joe Makowiec" <webmaster@munged.brunswicklibrary.invalid> wrote in message
news:Xns976584FB9E6D7makowiecatnycapdotrE@216.104.212.96...
> On Thu 09 Feb 2006 12:24:41p, Murray *TMM* wrote in
> macromedia.dreamweaver:
>
>
> Apache 2, so odds are good.
| |
| Joe Makowiec 2006-02-12, 6:37 pm |
| On Thu 09 Feb 2006 12:24:41p, Murray *TMM* wrote in macromedia.dreamweaver:
> Hmm - I wonder if the server supports PHP? 8)
Apache 2, so odds are good.
| |
|
|
| bregent 2006-02-12, 6:38 pm |
| >The page you currently have up there needs to have a *.php ending. The
>script you're server side including is a PHP script - so it will need to be
>named test.php to work.
No, it doesn't. It will work either as a ssi or php. I've tried it and it
works for me either way.
skowhegan, save your file with a .txt extension and give us the url so we can
see exactly what is on the page.
| |
| skowhegan 2006-02-12, 6:39 pm |
| HI Thank you all for helping. I have saved the page as txt. I have tried so many things that now the page is full of extra code but here it all it.
http://www.msad54.org/smithfield/test.txt
| |
|
|
"skowhegan" <webforumsuser@macromedia.com> wrote in message
news:dsgpus$kgl$1@forums.macromedia.com...
> HI Thank you all for helping. I have saved the page as txt. I have tried
> so many things that now the page is full of extra code but here it all
> it.
>
> http://www.msad54.org/smithfield/test.txt
An SSI must never have extraneous code such as DOCTYPE, head tags, body tags
etc. You must think of an SSI as part of the including page. You're not
supposed to have that stuff twice. Clean up all extraneous code.
tim
| |
| skowhegan 2006-02-12, 6:42 pm |
| Ok.. I think i cleaned up the page. Here is the code for the test.txt
var montharray=new
Array("January","February","March","April","May","June","July","August","Septemb
er","October","November","December")
var serverdate=new Date(currenttime)
function padlength(what){
var output=(what.toString().length==1)? "0"+what : what
return output
}
function displaytime(){
serverdate.setSeconds(serverdate.getSeconds()+1)
var datestring=montharray+" "+padlength(serverdate.getDate())+",
"+serverdate.getFullYear()
var
timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes(
))+":"+padlength(serverdate.getSeconds())
document.getElementById("servertime").innerHTML=datestring+" "+timestring
}
window.onload=function(){
setInterval("displaytime()", 1000)
}
I added this ssi
<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->
But that does not point to the test.txt file. Do I have to add another ssi to
get the date to tick?
But when I view the page ...this is what I see.
http://www.msad54.org/smithfield/timetest.shtml
| |
| bregent 2006-02-12, 6:43 pm |
| >An SSI must never have extraneous code such as DOCTYPE, head tags, body tags
>etc. You must think of an SSI as part of the including page. You're not
>supposed to have that stuff twice. Clean up all extraneous code.
That's true for an included page. The code that the OP is trying to implement
does use an included page - just a single shtm page. It looks to me that the
author of this code uses the SSI engine only to derive the server time.
I've tried the code as published from the author and it works without
modification. If it's not working for the OP, I suspect it's an SSI config
issue.
| |
|
|
"bregent" <webforumsuser@macromedia.com> wrote in message
news:dslr05$a2f$1@forums.macromedia.com...
>
> That's true for an included page. The code that the OP is trying to
> implement
> does use an included page - just a single shtm page.
The poster sent a link to a .txt file which had extra code in it. Obviously,
a .txt file would be an include, not a main page.
tim
| |
|
|
"bregent" <webforumsuser@macromedia.com> wrote in message
news:dslsqu$c8l$1@forums.macromedia.com...
>
> Tim, I asked him to save his PHP file as a txt file so the server wouldn't
> parse it and we could read it all of the code in it.
Ah, gotcha. Sorry.
tim
| |
| bregent 2006-02-12, 6:43 pm |
| >The poster sent a link to a .txt file which had extra code in it. Obviously,
>a .txt file would be an include, not a main page.
Tim, I asked him to save his PHP file as a txt file so the server wouldn't
parse it and we could read it all of the code in it.
| |
| skowhegan 2006-02-12, 6:43 pm |
| Hi I found my problem with this script. The entire script is used. The ssi is in the script. Thank you all for your help. I have posted the page with this script.
http://www.msad54.org/smithfield
| |
| bregent 2006-02-12, 6:43 pm |
| >Hi I found my problem with this script. The entire script is used. The ssi is
in the script. Thank you all for your help. I have >posted the page with this
script.
Great. You might want to change the text from "Current Server Time" to
something more meaningful to your audience, like Current Time in Smithfield.
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|