Is it possible to trigger a conditional in EE via the server time?
{if servertime == 'midnight to 13:00'}
do this
{if:else}
do something else
{/if}
Thank you
Sure, you can use the {current_time}
global variable for basic conditionals. To use your example, here's how we'd check that the time's between midnight and 13:00:
{if
'{current_time format="%H%i"}' >= '0000' AND
'{current_time format="%H%i"}' <= '1300'
}
It's between 00:00 and 13:00
{if:else}
It isn't.
{/if}
If you're not opposed to using a little php in your template the user guide has a basic example to get you going: http://expressionengine.com/user_guide/modules/channel/channel_entries.html#start-on
There's also this plugin http://devot-ee.com/add-ons/cc-time-difference which may come in handy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With