Hello EE forums,
I am trying to use low_replace to search and replace the first instance of a keyword match in a paragraph. If a match isn’t found, it looks for the next combination, and then the next.
A really badly formed pseudo-code example:
{exp:low_replace find="Red Widgets" replace="<a >Red Widgets</a>" multiple="no"}
{if low_replace=null}
{exp:low_replace find="Blue Widgets" replace="<a >Blue Widgets</a>" multiple="no"}
{if low_replace=null}
{exp:low_replace find="Green Widgets" replace="<a >Green Widgets</a>" multiple="no"}
This line of text has Green Widgets
etc ...The purpose is to find the first keyword match in a paragraph, and then to wrap it with a hyperlink to specific parts of the website. If it doesn’t find a match, the next attempt looks for another combination and then another. When all is said and done, the final paragraph should only have one link to a specific page on the website, or none.
Thank you for any codeshare ideas ...