Old 14-10-2004, 09:55   #1 (permalink)
oli
Low flying star™
 
oli's Avatar
 
Join Date: Feb 2003
Location: Manchester, England.™
Posts: 10,018
Send a message via ICQ to oli Send a message via AIM to oli Send a message via Yahoo to oli
php gurus

I want to link a stylesheet to the time on a users pc, so different ones display at different times - not the foggiest but Im sure some php trickery will do the job.
Any ideas?
  Reply With Quote
Old 14-10-2004, 10:26   #2 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,206
I'd need more details but an easy one would be...

Code:
<?php $date = date("H"); if($date < 12) { define('STYLESHEET', 'morning.css'); } else if($date <18) { define('STYLESHEET', 'afternoon.css'); } else { define('STYLESHEET', 'evening.css'); } ?> <style type="text/css"> @import url(<?php echo STYLESHEET; ?>); </style>
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 14-10-2004, 10:28   #3 (permalink)
oli
Low flying star™
 
oli's Avatar
 
Join Date: Feb 2003
Location: Manchester, England.™
Posts: 10,018
Send a message via ICQ to oli Send a message via AIM to oli Send a message via Yahoo to oli
nice one mate, Ill give that a go. Thats what I wanted , a morning, afternoon and evening.
Will that be based on the server time or users pc ?
  Reply With Quote
Old 14-10-2004, 11:13   #4 (permalink)
smallbeer
I Ain't Losing Any Sleep™
 
Join Date: Apr 2003
Posts: 5,206
oh yeah, I should read the questions better. that'll be based on the server time.

Hmmm, javascript is needed for the users local time. Try this...

Code:
<script type="text/javascript> var now = new Date(); var hour = now.getHours(); $date = document.write(hour); </script> <?php if($date < 12) { define('STYLESHEET', 'morning.css'); } else if($date <18) { define('STYLESHEET', 'afternoon.css'); } else { define('STYLESHEET', 'evening.css'); } ?> <style type="text/css"> @import url(<?php echo STYLESHEET; ?>); </style>
__________________
That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
  Reply With Quote
Old 14-10-2004, 11:29   #5 (permalink)
oli
Low flying star™
 
oli's Avatar
 
Join Date: Feb 2003
Location: Manchester, England.™
Posts: 10,018
Send a message via ICQ to oli Send a message via AIM to oli Send a message via Yahoo to oli
cheers mate, will give it a go later,
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8