A smarty variable question...

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
sarah_h
Forum Members
Forum Members
Posts: 189
Joined: Tue Apr 25, 2006 8:30 am

A smarty variable question...

Post 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
NaN

Re: A smarty variable question...

Post 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.
sarah_h
Forum Members
Forum Members
Posts: 189
Joined: Tue Apr 25, 2006 8:30 am

Re: A smarty variable question...

Post by sarah_h »

Thank you - that did the trick!
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: A smarty variable question...

Post by Dr.CSS »

Ok after 100 some post you must know by now to put [solved] in the subject line of first post...
Post Reply

Return to “Modules/Add-Ons”