Jump to content

citywebs

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by citywebs

  1. Thanks for the reply, I am not a PHP scripter so I do need a little help as to where to put this. I didnt make the script so I dont know if this is complicated or not. I do want the times to display under the open/closed sign but obviously on a closed day I want it to say Closed - will the script you gave me do this? Once again thanks for your reply.
  2. I am currently building a website for a “shopping village” (http://customers.citywebs.co.uk/taverham/opening-times.php), it’s only a small website consisting of about 13 shops which are all very small business. I thought it would be a great idea to include there opening times and then to say “shop open” or "shop closed", depending on the day and time etc. However a few of the shops don’t open on Sundays and Mondays – this is where I am stuck, how do I tell the PHP script that a shop is closed on a Monday and to display the closed sign! I have entered 00.00-00.00 but then this just says that the shop is open from 12.00am till 12.00 pm, i really want this to say "Shop Closed".....if any one can help this would be apoprecated, I have included the script below which is from Cory Etzkorn, I have emailed him but he has not got back to me. Thanks! You can view the script in action by goign to http://customers.citywebs.co.uk/taverham/opening-times.php <?php // -------- PHP STORE HOURS --------- // ---------- Version 1.1 ----------- // -------- BY CORY ETZKORN --------- // -------- coryetzkorn.com --------- // -------- EDIT FOLLOWING SECTION ONLY --------- // Set your timezone (codes listed at http://php.net/manual/en/timezones.php) // Delete the following line if you've already defined a timezone elsewhere. date_default_timezone_set('Europe/London'); // Define daily open hours. Must be in 24-hour format, separated by dash. $time_range_mon = '09.00-17.00'; $time_range_tue = '09.00-17.00'; $time_range_wed = '09.00-17.00'; $time_range_thu = '09.00-17.00'; $time_range_fri = '09.00-17.00'; $time_range_sat = '09.00-17.00'; $time_range_sun = '10.30-16.30'; // Place HTML for output here. Image paths or plain text (H1, H2, p) are all acceptable. $open_output = '<img src="images/open-sign.png" alt="Come in, we\'re open!" />'; $closed_output = '<img src="images/closed-sign.png" alt="Sorry, we\'re closed!" />'; // OPTIONAL: Output current day's open hours $echo_daily_hours = true; // Switch to FALSE to hide numerical display of current hours $time_output = 'g.ia'; // Enter custom time output format (options listed here: http://php.net/manual/en/function.date.php) $time_separator = ' until '; // Choose how to indicate range (i.e XX - XX, XX to XX, XX until XX) // -------- END EDITING -------- // Gets current day of week $status_today = date("D"); // Gets current time of day in 00:00 format $current_time = date("G:i"); // Makes current time of day computer-readable $current_time_x = strtotime($current_time); // Builds an array, assigning user-defined time ranges to each day of week $all_days = array("Mon" => $time_range_mon, "Tue" => $time_range_tue, "Wed" => $time_range_wed, "Thu" => $time_range_thu, "Fri" => $time_range_fri, "Sat" => $time_range_sat, "Sun" => $time_range_sun); foreach ($all_days as &$each_day) { $each_day = explode("-", $each_day); $each_day[0] = strtotime($each_day[0]); $each_day[1] = strtotime($each_day[1]); } // Defines array of possible days of week $week_days = array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"); // Compares current day of week to possible days of week and determines open vs closed output based on current day and time. foreach ($week_days as &$each_week_day) { if ($status_today == $each_week_day) { echo '<div class="open-closed-sign"><div class="opening-times-title">Opening Times</div>'; if (($all_days[$each_week_day][0] <= $current_time_x) && ($all_days[$each_week_day][1] >= $current_time_x)) { echo $open_output; } else { echo $closed_output; } if ($echo_daily_hours) { echo '<br /><strong class="opening-times-font">We are open today from <span class="time_output">'; echo date($time_output, $all_days[$each_week_day][0]) . $time_separator . date($time_output, $all_days[$each_week_day][1]); echo '</strong><div class="other-opening-times">Mon - Fri: 9.00am - 5.00pm<br />Sun: 10.30am - 4.30pm</div></span>'; } echo '</div>'; } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.