Tilted Forum Project - TFP - Sexuality, Philosophy and Political Discussion

Go Back   Tilted Forum Project - TFP - Sexuality, Philosophy and Political Discussion > Interests > Tilted Technology

Reply
 
LinkBack Thread Tools
Old 12-14-2005, 07:43 PM   #1 (permalink)
Crazy
 
Join Date: May 2004
javascript to php?

Hello,

So thanks to the help of JinnKai, I was able to get this excellent piece of code to do exactly what I needed

Code:
<script language="JavaScript">

var today = new Date();
var hours = today.getHours();

if (hours >= 0 && hours < 6)
document.write("Midnight");

else if (hours >= 6 && hours <9)
document.write("Prime");

else if (hours >= 9 && hours <12)
document.write("Terce");

else if (hours >= 12 && hours < 15)
document.write("Sext");

else if (hours >= 15 && hours < 18)
document.write("None");

else if (hours >= 18 && hours < 21)
document.write("Vespers");

else
document.write("Compline");

</script>
Now it ends up the problem is that javascript doesn't play well with the CMS I'm using. But it does do php. But I don' t know php at all. How difficult would it be to do so?

thanks.
TheProf is offline   Reply With Quote
Old 12-16-2005, 06:56 AM   #2 (permalink)
d*d
Addict
 
d*d's Avatar
 
Join Date: Sep 2004
That would be fairly simple to convert to php, the structure wouldn't need to change just a few commands, wrap it in <?php ?>, and document.write becomes echo"";

check on php.net to find out how to use the date function and you don't need to specify var hours for a variable but all variables do need a $ symbol ($hours = Date())
__________________
see the irony ... SEE IT
d*d is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript, php

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -7. The time now is 11:30 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
All text (c) 2002-2008 Tilted Forum Project
"Insignia" vBulletin 3.5 - b6gm6n - x7x7x7.com