ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

low_replace for linking to specific pages from paragraph

September 26, 2010 2:31pm

Subscribe [1]
  • #1 / Sep 26, 2010 2:31pm

    togs

    9 posts

    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 ...

  • #2 / Sep 28, 2010 8:31pm

    togs

    9 posts

    Maybe there is another plugin other than low_replace that can be used?

    Thank you forums,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases