ReReplacer

Change URL text within html, based on URL of that page.

5 months 1 day ago #77449

Vicky Thomas's Avatar Vicky Thomas

I installed ReReplacer Pro, and find myself a bit lost now in how to do this. I just don't understand how to make this happen. Please assist:

I would like for the text on a Joomla page to change from '/enroll ' (this is part of a URL link within the text) to '/enroll2', when this link with '/enroll' is displayed on a web page that has 'course/fundamentals-instructor-certification-course' in the URL of that page. Otherwise, it would not change the text '/enroll '. That text string, '/enroll ' does not show up anywhere outside of the URL text.

Does that make sense? Is ReReplacer able to do this and if so, please explain the logic and how to set this up.
Thank you!!! Vicky

5 months 1 day ago #77450

Peter van Westen's Avatar Peter van Westen Admin

Yes, ReReplacer can d that.
But you will have to make sure that the url with '/enroll2' will work.
ReReplacer can change urls, but does not control how the url works.

Do you have this online so I can take a look?
So the url of the page where you want the replacement done and where it shouldn't.

5 months 21 hours ago #77452

Vicky Thomas's Avatar Vicky Thomas

yes, they are online. Details:

Confidential information:
(hidden)

Thank you! Vicky

5 months 13 hours ago #77456

Peter van Westen's Avatar Peter van Westen Admin

Replacing urls is a bit tricky, as Joomla changes urls at the very end of the process after plugins have run.
So it is hard to know what the url in the html looks like at the moment in the process when ReReplacer gets to look at the html.
But you can try this:
Search (Regular Expressions on):

href="([^"]*)/enroll"
Replace:
href="\1/enroll2"
Then use the 'Publishing Assignments' tab to assign it to the page you want it.
For instance, use the URL assignment option and enter:
/fundamentals-instructor-certification-course/course-link

Another way to solve this is use Conditional Content instead.
Then you can use conditions (like the url assignment) to output a button linking to /enroll2, and output a button to /enroll in all other cases.
{show urls="/fundamentals-instructor-certification-course/course-link"}
   [my button to /enroll2]
{show-else}
   [my button to /enroll]
{/show}

5 months 5 hours ago #77480

Vicky Thomas's Avatar Vicky Thomas

The first solution worked perfectly! And I tweaked the assignment URL to grab all pages in that course (soon there will be more lessons) and it works just as I had hoped.
Veel dank! Vielen Dank! Many thanks!

5 months 5 hours ago #77481

Peter van Westen's Avatar Peter van Westen Admin

My pleasure :)