Welcome Guest ( Log In | Register)



2 Pages V  < 1 2  
Reply to this topicStart new topic
> Background Image Swap Script, Change a Background Image based on clock time
t3jem
post Nov 14 2007, 12:14 AM
Post #11


Privileged Member
*********

Group: [HOSTED]
Posts: 522
Joined: 9-February 07
Member No.: 38,519



QUOTE(jlhaslip @ Nov 12 2007, 11:36 PM) *
Here is another, simpler, method. Serve a different CSS file based on the time of day.
Replace your existing link tag with the following php code.
You will need 3 CSS files named according to the file names used in the script, of course, with the background image changed in each one according to the preferred design.

CODE
<?php
$hour = date('H');
if ($hour < 12 ) {
     echo '<link rel="stylesheet" type="text/css" href="morning.css" />;
}
elseif ($hour < 17 ) {
     echo '<link rel="stylesheet" type="text/css" href="day.css" />;
}
else {
     echo '<link rel="stylesheet" type="text/css" href="night.css" />;
}
?>

Untested. No example available.


That is actually the way I do my styles for different times of years, except because I'm too lazy to test on my website i do it in javascript, but it's almost the exact same code. Thanks for the code though, I can see it now.
Go to the top of the page
 
+Quote Post
hippiman
post Nov 14 2007, 10:45 PM
Post #12


Premium Member
********

Group: Members
Posts: 150
Joined: 9-April 07
From: Nebraska
Member No.: 41,301



That's pretty friggin sweet! I didn't know you could name a folder with an extension. I wonder what else you could use that for... smile.gif
Go to the top of the page
 
+Quote Post
jlhaslip
post Jan 2 2008, 04:02 AM
Post #13


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,971
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



QUOTE(hippiman @ Nov 14 2007, 03:45 PM) *
That's pretty friggin sweet! I didn't know you could name a folder with an extension. I wonder what else you could use that for... smile.gif


This technique can also perform Random Image Generators and a Random sig or avatar rotator script.
I have another Tutorial around here on the trap that shows the Random Avatar, I think it is... gif's, png's, jpg's or a combined image script.

http://www.trap17.com/forums/index.php?s=&...st&p=350113

There it is...
Go to the top of the page
 
+Quote Post
Dooga
post Jan 2 2008, 11:49 PM
Post #14


Moderator
Group Icon

Group: [MODERATOR]
Posts: 1,332
Joined: 26-December 04
From: Canada
Member No.: 2,940



I think this is pretty clever. I saw a lot of professional web designers who actually use the day and night difference, because it makes the site look like a place in real life! It also has sounds that correspond with the time of day. Perhaps that could be your next tutorial when you're bored and want to cook up something else that's as brilliant as this one smile.gif
Go to the top of the page
 
+Quote Post
jlhaslip
post Jul 19 2008, 04:37 AM
Post #15


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,971
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



Attention!!!

Someone sent me an email a few days ago about this script not working for them, and I somehow misfiled or deleted the e-mail, so if you have a question, please PM or email me.

Thanks for your interest in the script.
Go to the top of the page
 
+Quote Post
bad_boy
post Jul 19 2008, 09:55 AM
Post #16


Newbie [Level 2]
**

Group: Members
Posts: 37
Joined: 18-July 08
Member No.: 65,166



Hello everyone,
this right can work in any browser?
Few make this idea but try, I'm nob in the world of web design ... I hope that you will understand and support if something does not know I should be .. Thanks for the code angel.gif
Go to the top of the page
 
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. A Little Introduction To 3d Studio Max(9)
  2. Php Quiz Script(20)
  3. Email Script/form With Php(35)
  4. Image Preloader With Progress Bar Status(22)
  5. Secure The Email Addresses On Your Website!(10)
  6. Image Rollovers In Javascript(11)
  7. How To Stop Image Hot Linking(17)
  8. Changing Background Color In Php(5)
  9. Page Generation Time Script(17)
  10. Php Menu Bulding Script And Site Template(0)
  11. Creating A Simple Image Viewer(3)
  12. Image Shack Mod(2)
  13. Php Script To Make A Link List(6)
  14. Beginner's Guide To Skiing(4)
  15. How To: Ip Configuration Script (win Xp)(0)
  1. How To Make Image To Highlight When It`s Mouseovered(8)
  2. Image Gallery Tutorial Using Hoverbox(14)
  3. A Simple Php Captcha - Image Validation(21)
  4. How To Make A Simple File Based Shoutbox Using Php And Html(8)
  5. Css-based "i-frames" (sort Of)(1)
  6. Math Captcha Image Validation(1)
  7. For ... Next Loops And Script Planning(2)
  8. Making a java based program(3)
  9. Faux Ajax Loading - Css Only(3)
  10. Image Rotator Script (another One)(0)
  11. [phpbb] Member Last-visit Report Script(0)
  12. Make A Flat Based Shoutbox, With Auto Refresh.(6)
  13. How To Install Opengeu In Ubuntu(0)


 



- Lo-Fi Version Time is now: 30th August 2008 - 04:21 PM