You are not logged in.

Announcement

Forum database was corrupt and an old backup was restored as temporary replacement. Registrations closed until the database is recovered. Please ask questions using the Contact form

#1 15-05-2014 11:19:02

thejaff
Contributors
From: Millers Falls, MA
Registered: 30-04-2013
Posts: 19
Website

Loading different content based on the day of the week.

Well, I'm back. I started building a page almost 8 months ago and put it on the shelf for about the last 5.. I was just starting to get the hang of thing but the business got overwhelming. Now I have found some time to begin afresh.

What I am looking to do is very similar to something I tried back then. We are a small bakery, and originally I wanted to have a tile that scrolled through the various soups we offered on a given day. Clicking on the soup currently displayed would take you to a page listing a description, etc. It worked fantastically, but only because of the help I got here. The only problem is that we vary the soups every day. There is no set schedule. It got very tedious to update the soups we had every morning. It was a great idea and the result was perfect.. but the practice of maintaining it left a little to be desired.

However I have now thought of a better use of the same concept, which is to have it slideshow through, not soups, but the breads we offer on a given day. The good thing about this is that we have a bread schedule. Meaning every Tuesday we offer the same breads, every Friday we offer the same breads, etc. The only monkey wrench in this idea is that we are closed on Monday and offer no bread.

So I am wondering how to go about this idea of somehow querying what day of the week it is, and filling in the slideshow to show only the breads offered on that day.. I suppose a single slide that simply says that we are closed and offer no bread that day would suffice for the Monday one,,

Thanks for any help that can be provided and thanks again for such an amazing template.. glad to be back.

Offline

#2 15-05-2014 11:34:03

Thomas
Administrator
Registered: 10-03-2013
Posts: 897

Re: Loading different content based on the day of the week.

You can execute any PHP based on the day of the week::

Pseudocode to put in config/tiles.php , didn't test it:

<?php
date_default_timezone_set('UTC'); // set the right timezone
$jd=cal_to_jd(CAL_GREGORIAN,date("m"),date("d"),date("Y"));
$day = jddayofweek($jd,0);

switch($day){

case 0: // Sunday
// do something

$tile[] = array("type"=>"slideshow", "group"=>0, "x"=>0, "y"=>0 ...images for Sunday);

break;
case 1: // Monday
// do something

$tile[] = array("type"=>"simple", "group"=>0, "x"=>0, "y"=>0, "text"=>"We're closed today...");

break;


//....


case 6: // Saturday
// do something

$tile[] = array("type"=>"slideshow", "group"=>0, "x"=>0, "y"=>0 ...);

break;
}
?>

You could just place a different tile for each day, with different images. Only the tile for that day will be displayed.

Ofcourse, you could do the same on a subpage (but instead of defining tiles, echo some different text with php)

Offline

#3 15-05-2014 14:41:59

thejaff
Contributors
From: Millers Falls, MA
Registered: 30-04-2013
Posts: 19
Website

Re: Loading different content based on the day of the week.

Wow!!! Thats amazingly elegant.. thank you so much! Ill get right to work!

Offline

Board footer

Powered by FluxBB