1. Computing & Technology

Discuss in my forum

Angela Bradley

Time Based Website Layouts

By , About.com GuideMay 15, 2011

Follow me on:

Ardmad Writes:

I want to change my website layout based on time. If it's 7am - 7pm, I would like the php to echo my 1st layout for my visitors to see. If it's 7pm-7am, then it will echo the 2nd layout.

This example shows you how to do basically what you're looking for. It is a script that changes your websites greeting based upon the time of day. Obviously you would change the times to the times needed for your website. Then instead of echoing a greeting, just change that line to be an include file with your layout. If you have questions, the forum is always a good place to ask!

Comments
June 2, 2011 at 11:49 pm
(1) Ashutosh :

Hi Well u can use javascript
bt you have to make two website home pages for th e same(because i do not no about xml template)
let it be
website1.html
website2.html

var d = new Date();
if(d.getHours()’19′) // bfor 7am & aftr 7pm
window.top.location = “website1.html”;
else
window.top.location = “website2.html”;

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2012 About.com. All rights reserved.

A part of The New York Times Company.