LG Replace is a different kind of text replacement plugin.
How many times have you wanted to add a dynamic date inside some user content? Or add some related links half way down an entry?
Now you can with LG Replace! Its simple to use heres the quick rundown:
1. Wrap your content in the {exp:lg_replace:haystack}{/exp:lg_replace:haystack} template tag and list the needles you would like to replace in the needles=”” attribute.
2. Add the “needles” inside the {exp:lg_replace:haystack}{/exp:lg_replace:haystack} tags. The needles must be in the following format {my_needle_id} and the needle_id must be listed as one of the needles in the needles=”” attribute of {exp:lg_replace:haystack}{/exp:lg_replace:haystack}.
3. Now that the “needles” are in our “haystack” we need to tell the plugin what to replace them with. This is done using the {exp:lg_replace:replacement}{/exp:lg_replace:replacement} tag. This tag must have an needle_id=”” attribute that links it to the needle inside of {exp:lg_replace:haystack}{/exp:lg_replace:haystack}.
That’s it. Checkout the demo below as a test.
{exp:lg_replace:haystack needles="test1|test2|test3|test4"}
{exp:lg_replace:replacement needle="test1"}
Replace {test1} with this content
{/exp:lg_replace:replacement}
{exp:lg_replace:replacement needle="test2"}
Replace {test2} with this content
{/exp:lg_replace:replacement}
{exp:lg_replace:replacement needle="test3"}
Replace {test3} with this content
{/exp:lg_replace:replacement}
{exp:lg_replace:replacement needle="test4"}
Replace {test4} with this content
{/exp:lg_replace:replacement}
Here is some content which will be replaced:
- {test1}
- {test2}
- {test3}
- {test4}
{/exp:lg_replace:haystack}
I also should mention that the content of {exp:lg_replace:replacement}{/exp:lg_replace:replacement} can include other EE tags which makes this plugin very flexible and powerful.
Try it out… give it a kick in the tyres and then I will move it over to my site with better documentation
