Page 1 of 1

A smarty variable question...

Posted: Mon Jul 27, 2009 6:11 pm
by sarah_h
I have some smarty template vars like this:

{$day} {$month_names.$month} {$year}

This just constructs a date: 02 July 2009 (each is a separarate var)

I need to compare this date with another date. The second date is a string: "2 July 2009" but the one above is day month year. How can I compare them? I was thinking that I could chnage the D M Y 'bits' into a string but I can see a way to do this using smarty!

The application is this: a list of events retrieved from the calendar module and listed on a page. I need to be able to compare each event to a set date and then do something. I'm at a loss as to how I can achieve this at the mo'.

Can anyone guide me?

Sarah

Re: A smarty variable question...

Posted: Mon Jul 27, 2009 6:22 pm
by NaN
Try the smarty modificator "concat" (concatenate).
This will stick several strings together.
If you assign the output of concat to a variable you can compare the two date strings.

Re: A smarty variable question...

Posted: Wed Jul 29, 2009 9:17 am
by sarah_h
Thank you - that did the trick!

Re: A smarty variable question...

Posted: Wed Jul 29, 2009 8:20 pm
by Dr.CSS
Ok after 100 some post you must know by now to put [solved] in the subject line of first post...