Search for string part per TypoScript

To search a string part (needle) in string (haystack), you can easily use the PHP strpos function. But this function doesn’t exist in TypoScript.

The following TypoScript return true if the needle is found in the haystack. This can be used in an if condition.

The above COA will return true if http is found in the header_link field. I used this to add ATagParams for external link, in assumption that link with http(s) is an external link.

Leave a Reply

Your email address will not be published. Required fields are marked *