[Solved] How to check if a string exist in 2 smarty variables
Hello,
I have a tracker with a relation tracker field that look like this: "Banked ,July - Bernard | $720". I'm looking for a way to detect when the month in the field's value more than 1 month in the past.
IE:
We are in August;
if value is "Banked ,July - Bernard | $720" do nothing
if value is "Banked ,June - Bernard | $720" do something
From a wiki page I have a plugin list and then a smarty template.
In the foreach loop I grab the variable "$row.tracker_field_productsboughtPaymentId_text" that output the field _text value ("Banked ,July - Bernard | $720"). So the following comparison between a variable and a string is working just fine:
{$paymentref = $row.tracker_field_productsboughtPaymentId_text} {if $paymentref|strstr:"July"}Say hi{/if}
However I don't want to hardcode the month of the year and want to have it based on the smarty.now date. So I created a variable for "month minus 1" and now try to compare 2 variables the same ways before.
But this is not working (I tried with single quote, no quotes, no bracket parentheses...)
{$month = "-1 month"|date_format:"%B"} {$paymentref = $row.tracker_field_productsboughtPaymentId_text} {if $paymentref|strstr:"{$month}"}Say hi{/if}
I am missing something there or I should use something else to check if a variable contain something from another variable ?