Search
Other ReReplacer questions
Forum

ReReplacer like autolink

marvays's Avatar marvays
Hi.
I want to use a component to create automatic links from text.
For example, from the product description in virtuemart.
I found the perfect extension to manage such links, but it's outdated and slows down the site incredibly, up to the 500 error.
That's why I thought of using ReReplacer for that.

For example, I want to display a link to the subpage "/3d-targets" on the word "3D targets" and add a title.
And all this only assuming that the word is found in <div class="product-description col-md-12">

How to do it?

Here is an example:

Befor
<div class="product-description col-md-12">
<h2 class="page-header">Popis</h2>
<div class="ThinBorderRelative"> </div>
<ul>
<li>Recommended for shooting at 3D targets.</li>
</ul>
</div>

After:
<div class="product-description col-md-12">
<h2 class="page-header">Popis</h2>
<div class="ThinBorderRelative"> </div>
<ul>
<li>Recommended for shooting at <a href='/3d-targets' title='A 3D target is a target made of special artificial materials to perfectly imitate an animal.'> 3D targets</a>.</li>
</ul>
</div>
Peter van Westen's Avatar Peter van Westen ADMIN
You can use the "Search between" options under the Search Area settings in ReReplacer to limit the search.
However, using the <div> tags is a bit difficult, as there are ending </div> tags before the container div ends.

So what you could do is use template overrides ta add something unique to the output of the <div class="product-description col-md-12">.

For instance:
<!-- START PRODUCT DESCRIPTION -->
<div class="product-description col-md-12">
...
</div>
<!-- END PRODUCT DESCRIPTION -->

Then you can set up ReReplacer to only replace between "<!-- START PRODUCT DESCRIPTION -->" and "<!-- END PRODUCT DESCRIPTION -->".

PS: If you want to create many links like this, all with the same settings, use an XML file to put them all in.
See: docs4.regularlabs.com/rereplacer/going-further/use-xml-file
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription