Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
if day of the week =
I’m in the midst of a restaurant site.
I want to display content based on the day of the week. Not date – day.
Example:
If Tuesday:
Tuesday menu
If Wednesday:
Wednesday menu
etc.
If there is a built in obvious way to do this, I’ve missed it. A <txp:if_day /> tag doesn’t seem to exist. I haven’t found a plugin thus far.
Ideas?
Offline
Re: if day of the week =
<txp:etc_if_date value="2" format="%u">
Tuesday menu
</txp:etc_if_date>
Edit: changed format, sorry.
Last edited by etc (2013-06-02 17:55:29)
Offline
Re: if day of the week =
Here is an untested solution without a plugin
<txp:variable name="weekday" value='<txp:php>echo date('D');</txp:php>' />
<txp:if_variable name="weekday" value="Mon">
Monday menu
</txp:if_variable>
<txp:if_variable name="weekday" value="Tue">
Tuesday menu
</txp:if_variable>
... etc
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: if day of the week =
etc Oleg – that plugin works. Problem solved – thank you for the simple solution.
Keith
Offline
Pages: 1