Using smarty to check for a string inside another string:
{assign "haystack1" "whatever_thestring_whatever"} {assign "haystack2" "whatever_thestrings_whatever"} Test haystack1 {if $haystack1|strstr:"_thestring_"}Found!{/if}<br /> Test haystack2 {if $haystack2|strstr:"_thestring_"}Found!{/if}<br /><br />
Output:
Test haystack1 Found! Test haystack2
Or you can do a more sophisticated search using Regex in smarty:
{assign "haystack1" "whatever_thestring_whatever"} {assign "haystack2" "whatever_thestrings_whatever"} {assign "check_haystack1" $haystack1|regex_replace:"/_thestring_/":" "} {assign "check_haystack2" $haystack2|regex_replace:"/_thestring_/":" "} Test haystack1 {if $check_haystack1 !== $haystack1}Found!{/if}<br /> Test haystack2 {if $check_haystack2 !== $haystack2}Found!{/if}<br />
Which has an output:
Test haystack1 Found! Test haystack2
source share