Time sensitive content

Hi there,

I’m new to FW, but am delighted that I’m starting to get some traction.

My objective is to build a webpage for a pub. We have daily specials which repeat week after week.

  1. Is it possible to display content on specific days only?
  2. Is it possible to display content which will expire on a certain date (never to reappear)?

Maybe the answers to these questions are already in the forum? I searched for terms like “expire”, but no joy. If the answer is already there, can you let me know the terms I should be searching for?

Free virtual pints for everyone who helps!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

We had a little discussion about this here: http://www.freewaytalk.net/thread/view/84601#m_84606 but in the context of monthly changes, not daily. You could easily adjust my code to use a different PHP Date() variable. To get the day of the week, you would use

$day_of_the_week = date('N') - 1;

And then seven images in a folder, following the same script. Of course, replace $month everywhere in that script with $day_of_the_week.

Walter

On Mar 17, 2013, at 12:34 PM, Stephen Todd wrote:

Hi there,

I’m new to FW, but am delighted that I’m starting to get some traction.

My objective is to build a webpage for a pub. We have daily specials which repeat week after week.

  1. Is it possible to display content on specific days only?
  2. Is it possible to display content which will expire on a certain date (never to reappear)?

Maybe the answers to these questions are already in the forum? I searched for terms like “expire”, but no joy. If the answer is already there, can you let me know the terms I should be searching for?

Free virtual pints for everyone who helps!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

And just to point to an example.

http://www.deltadesign.co/examples/picofmonth.php

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi everyone,

Thanks very much for the quick responses and great help ive received so far.

I think my solution may be even simpler, please excuse me for the newbie questions - I’m learning this by trial and error…

Everyday I have a different “special”. I would like to adapt the code “$day_of_the_week = date(‘N’) - 1;” to show the special each day of the week.

For instance:

Monday - Tenants

Tuesday - Smithwicks

Wednesday - Guinness

Etc, etc…

Can the code above be adapted for days of the week (rather than definitive calendar dates) and can is be incorporated in a Freeway HTML element? (I’m not familiar with PHP).

I’ve little to no experience with coding. If you could recommend a newbie resource, I would also appreciate that!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Mar 18, 2013, at 3:35 PM, Stephen Todd wrote:

Hi everyone,

Thanks very much for the quick responses and great help ive received so far.

I think my solution may be even simpler, please excuse me for the newbie questions - I’m learning this by trial and error…

Everyday I have a different “special”. I would like to adapt the code “$day_of_the_week = date(‘N’) - 1;” to show the special each day of the week.

For instance:

Monday - Tenants

Tuesday - Smithwicks

Wednesday - Guinness

Etc, etc…

Can the code above be adapted for days of the week (rather than definitive calendar dates) and can is be incorporated in a Freeway HTML element? (I’m not familiar with PHP).

This code does use days of the week. date(‘N’) will output 1 - 7 depending on the day, the -1 is there to make the number zero-based, since the array of files in the folder will come to you in a zero-based array.

I’ve little to no experience with coding. If you could recommend a newbie resource, I would also appreciate that!

You’re going to have to start somewhere. This is not strictly possible without some sort of programming. Whether you do it in PHP or JavaScript or Ruby, getting a different thing to happen on a different day takes programming.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This uses your bit of php code to show the text you mentioned on certain days of the week.

  1. The first part checks the server version of PHP is at or above php 5.1 when date(‘N’) becomes available, otherwise it reverts to date(‘l’), I guess you could just use ‘l’ but does no harm to try to keep up with things.

  2. The switch statement sets the PHP variable of ‘$day_of_the_week’ to the text for the current day.

  3. The ‘echo $day_of_the_week;’ prints the text onto the page.

You could actually remove the echo line from the code below, place this code at the top of your .php page (in the ‘Before HEAD’ section of the Page > Markup), then set a mark up item on the page where you want the text to go, paste in the echo line of code and enclose then in the php tags

<?php
echo $day_of_the_week;
?>

then type a space before the mark up item and one after it then select the mark up item along with the spaces and apply a style.

Note that this will function using the time on the server the script is located on, so if the server is in the USA and you are in England then you might need to adjust this.

<?php
// Check PHP Version
if(phpversion() >= "5.1.0") {
    // php is version 5.1 or above
    // The -1 will knock the day number back to what 'l' returns so make both results compatible with the same switch statement.
    $theDayNum = date('N')-1; // 1 (Monday) through 7 (Sunday)
} else {
    // If php is less than version 5.1
    $theDayNum = date('l'); // 0 (Monday) through 6 (Sunday)
}
// Which day is it 0 - 6
switch ($theDayNum) {
    case 0:
        $day_of_the_week = "Today is Tennants day"; // Mon
        break;
    case 1:
        $day_of_the_week = "Today is Smithwicks day"; // Tues
        break;
    case 2:
        $day_of_the_week = "Today is Guinness day"; // Wed
        break;
    case 3:
        $day_of_the_week = "Today is Carlsberg day"; // Thurs
        break;
    case 4:
        $day_of_the_week = "Today is Harp day"; // Fri
        break;
    case 5:
        $day_of_the_week = "Today is Double Diamond day"; // Sat
        break;
    case 6:
        $day_of_the_week = "Today is a Bud day"; // Sun
        break;
    default: // ?
        $day_of_the_week = "Today does not seem to exist";
        break;
}
echo $day_of_the_week;
?>

Some information on using PHPs date() function can be found here:
http://php.net/manual/en/function.date.php

HTH

On Mar 18, 2013, at 8:35 PM, Stephen Todd wrote:

Hi everyone,

Thanks very much for the quick responses and great help ive received so far.

I think my solution may be even simpler, please excuse me for the newbie questions - I’m learning this by trial and error…

Everyday I have a different “special”. I would like to adapt the code “$day_of_the_week = date(‘N’) - 1;” to show the special each day of the week.

For instance:

Monday - Tenants

Tuesday - Smithwicks

Wednesday - Guinness

Etc, etc…

Can the code above be adapted for days of the week (rather than definitive calendar dates) and can is be incorporated in a Freeway HTML element? (I’m not familiar with PHP).

I’ve little to no experience with coding. If you could recommend a newbie resource, I would also appreciate that!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

MikeB,

Thanks so much for this comprehensive explanation and link to reference material.

I’ve inserted it into Freeway as an HTML item, but publishing only shows the code.

Do I need to create this as a separate page?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I suspect you need to change the page from .html to .php then upload it again.

HTH

On Mar 18, 2013, at 11:23 PM, Stephen Todd wrote:

MikeB,

Thanks so much for this comprehensive explanation and link to reference material.

I’ve inserted it into Freeway as an HTML item, but publishing only shows the code.

Do I need to create this as a separate page?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Use Insert>Markup Item

Paste the code into the dialogue box that opens.

OK the box.

This will give you a little Markup item on your page which you can resize and reposition. Alternatively you can click into a run of text and insert it there.

Once you have it on the page make sure that your page suffix is .php (not .html)

Upload and test.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options