Good morning/afternoon/evening*

Dear friends,

I’m looking for a way to be able to show a greeting online depending on what the time is. So when its 09:00 hrs it would say ‘good morning’, on 14:00 hrs it would say good afternoon, etc …

Anyone an idea how to do this? Any help is much appreciated.

Best regards, Richard


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

Hi Richard,
Try this. Simply copy and paste into where you want it to appear in your Freeway layout (Insert > Markup Item);

<script language="JavaScript">
<!--
var today = new Date ()
var hrs = today.getHours();
if (hrs <= 12)
        document.write("Good Morning");
else if (hrs <= 18)
        document.write("Good Afternoon");
else
     document.write("Good Evening");
// -->
</script>
<noscript>Hello!</noscript>

Play with the numbers to get the greeting you want at the right time.
The script was pulled from here; Cut & Paste Greetings Script
The noscript block just makes sure that something gets written to the page even if JS is switched off in the browser.
Regards,
Tim.

On 27 Nov 2013, at 11:38, Richard van Heukelum wrote:

Dear friends,

I’m looking for a way to be able to show a greeting online depending on what the time is. So when its 09:00 hrs it would say ‘good morning’, on 14:00 hrs it would say good afternoon, etc …

Anyone an idea how to do this? Any help is much appreciated.

Best regards, Richard


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


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

There are also php + includes scripts for random, or day-of-the-week,
month, year, etc., content.


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

Yes there are many ways to do this sort of thing; JavaScript, SSI, PHP etc but I tend to advocate using JavaScript simply because it will give you the client time rather than the server time really easily. You can do it using PHP but it is a bit hit and miss as you’d have to figure out where the user is in the world based on their IP address.
Regards,
Tim.

On 27 Nov 2013, at 15:41, Ernie Simpson wrote:

There are also php + includes scripts for random, or day-of-the-week,
month, year, etc., content.


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

Wow, thanks a lot for your input guys!

I’ve been off site sinceI posted the request and I logged in just now. I’ll give it a go tomorrow, although I can’t wait, I’m in need some sleep urgently :wink:

Richard


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