A Useful Addition to any Business Website

August 5th, 2008 | 1 Comment | Posted in HTML

I’ve used this code in a large amount of business websites I’ve produced. It allows users to see at a glance whether a business is open or closed. If the time is within the specified hours, it will display an open image, if it any other time, it will display the closed image. It is easy to implement and looks great on a store hours page. It goes by the time of your server however so if your server is in a different timezone, adjust the hours accordingly. See a demo in action here.

<?php
/**
* Open / Closed script
* Try to edit only the ‘$hours’ array and the <img /> tags later on
* Editing anything else could give undesired results
*/

// These are the hours, correlating with the above days, in AM and PM format separated by ‘-’
$hours = array(‘Sunday’ => ‘Closed’,
‘Monday’ => ‘By Appointment’,
‘Tuesday’ => ’10AM-5PM’,
‘Wednesday’ => ’10AM-5PM’,
‘Thursday’ => ’10AM-5PM’,
‘Friday’ => ’10AM-6PM’,
‘Saturday’ => ’10AM-5PM’);

More »

Tags: , ,

Community News



Find all your favorite TV shows on Specialcabledeals.com, cabletelevisionbundles.s9.com, and other satellite and television providers.