PDA

View Full Version : Day conditonal in PHP?


Boofo
05-11-2010, 12:20 PM
Is there a way to compare today's date to a set variable in a template? Like using an If condition? I know what I'm trying to ask but it doesn't want to come out right to make sense. I want to compare this variable ($localdate) which has already been set, to whatever today's date is (not time) but I would like to do it in the template, if possible. Can it be done in the template?

Andreas
05-16-2010, 04:57 AM
You would have to create if first and stroe that result in a variable:

date('m-d-Y')



Afterwards to can compare the variable in templates to whatever you want.

However, you should not do that - IMHO.

The better way would be to just set a $show flag and check that in templates.