HTML Block - Timebased content
Posted: Sun Jan 08, 2017 7:01 pm
i'm using Smarty for my website. I'm trying to show some different content based on the time of day. But i'm doing something wrong with the logic i think.
I want to use these 3 timeframes (based on 24 hour period)
morning: 0600 - 1200
Afternoon: 1200 - 1800
Evening: 1800 - 0600
My HTML Block looks like this:
I want to use these 3 timeframes (based on 24 hour period)
morning: 0600 - 1200
Afternoon: 1200 - 1800
Evening: 1800 - 0600
My HTML Block looks like this:
Code: Select all
<!-- It is now {$smarty.now|date_format:"%H:%M"} -->
{if $smarty.now|date_format:"%H" >= 06 and $smarty.now|date_format:"%H" < 12 }{Showtime show='7'}
{elseif $smarty.now|date_format:"%H" >= 12 and $smarty.now|date_format:"%H" < 18}{Showtime show='8'}
{elseif $smarty.now|date_format:"%H" >= 18 and $smarty.now|date_format:"%H" < 06}{Showtime show='9'}{/if}