Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

automatic different look for morn, day and night


Guest

Recommended Posts

This is an heroic idea that loks to automate a different look (header banner and colour scheme) depending on the time of day.

 

If any body can help me develop such an idea it would be awesome,

 

basically, i would like the user to come to the site, the browser would look at the users clock and find out what time it is, depending on the time, moring lucnch or night, the site colour scheme would change e.g sunshine yellow for morning with banner of coffee and breakfast for example, lunch would be blue and banner of someone at work for example and night would be dark colors and stary, nighline banner.

 

Phew this would be a massive enhancement, what do you guys think? - is it posible?

 

Thanks

 

Mitchell :blink:

Link to comment
Share on other sites

Easy enough using the stylesheet to do it.......I think! Try this:

 

1. Save your stylesheet 3 times, as morning.css, day.css and evening.css

 

2. Make changes as you want in each stylesheet. For banners to change, just set them as background images.

 

3. Add this to the bottom of includes/functions/general.php before the closing ?> tag:

// This function will display a different stylesheet
// depending on the time of day and/or day of the week.

 function tep_time_display(){

//Get the hour of the day

$what_time = date(G);


if ($what_time >= 6 && $what_time <= 11) {
  $display = '<link rel="stylesheet" type="text/css" href="morning.css">';
}
  elseif ($what_time >= 12 && $what_time <= 18) {
	$display = '<link rel="stylesheet" type="text/css" href="day.css">';
	  } else { $display = '<link rel="stylesheet" type="text/css" href="evening.css">';

}
	return $display;
 }

 

4. In all your root level php files, replace this:

<link rel="stylesheet" type="text/css" href="stylesheet.css">

 

With this:

<?php echo tep_time_display(); ?>

 

 

I just tested it quickly and it worked ok in Firefox. Maybe one of the gurus can say if this is ok to use.

 

You can go further by using $what_day = date(l); to display a different stylesheet depending on a certain day. I'll leave you to play with that.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...