ReReplacer

ReReplacer

4 months 4 weeks ago #77647

Silke Menne's Avatar Silke Menne

Hi Peter,

I thought about buying Sourcerer PRO, but this depends on the functionality of ReReplacer. I was hoping, that you might bring light into the darkness (no urgent question):

Can I use ReReplacer/Regular Expression to fetch the current/active URL and replace it with a certain URL that I previously inserted in the <head>-section via Sourcerer PRO?

I plan to provide my website in a second language and the users shall be able to switch between the two sites. Same content, different language, seperate domain and seperate Joomla installation. Technically, I want to keep both sites clearly independent. I think, the first step would be to add two URLs (just examples):

<link rel="alternate" hreflang="x-default" href=" www.webseite.de/article-in-german.html " />
<link rel="alternate" hreflang="en" href=" www.website.net/article-in-english.html " />

via Sourcerer PRO to the <head>-section of each article. This is possible, isn' it?

Then I create a module containing a flag, and the flag shall automatically be linked with the current article in the other language. For this purpose I would use ReReplacer and Regular Expressions. If possible? Maybe I am thinking to complicated, but I am looking for a solution since months ...

Thanks for your help and best regards :)

Silke

4 months 3 weeks ago #77648

Peter van Westen's Avatar Peter van Westen Admin

Isn't this something Joomla already does out-of-the-box?
With the multi-lingual plugins enabled, you can connect articles (translations) to eachother and make the browser redirect to the correct one based on the language... AFAIK.
See: docs.joomla.org/J3.x:Setup_a_Multilingual_Site

Best to ask about this on the Joomla forum:
forum.joomla.org

4 months 3 weeks ago #77677

Silke Menne's Avatar Silke Menne

Hi Peter,

thanks for your answer :)

As far as I know, the multi-lingual plugin only works, when you have both languages/articles in one single joomla installation. It does not work when you have two seperate installations.
I think I give it up now. I will just place a notice on both sites that there is different language version, instead of connecting every single article.

Nevertheless, I think I will buy Sourcerer PRO anytime soon, because of its cool features.

Thanks and keep up good work!

Silke

4 months 3 weeks ago #77679

Peter van Westen's Avatar Peter van Westen Admin

You could make your own plugin style tag through ReReplacer.

Something like:

{en article-in-english.html}
Then dynamically search for that using Regular Expressions:
\{en (.*?)\}
And replace it with something like:
<a href="\1" title="English version"><span class="flag_en"></span></a>
You can even use that to add the alternate link to the head (PHP enabled):
<a href="http://www.website.net/\1" title="English version"><span class="flag_en"></span></a>
<?php
$doc->addCustomTag('<link rel="alternate" hreflang="en" href="http://www.website.net/article-in-english.html" />');
?>

And do the same on the other site for the german language.

4 months 3 weeks ago #77787

Silke Menne's Avatar Silke Menne

Hi Peter,

you are truly a wizard, thanks for your help! I will give it a try. It will take some time for me to test and check, because the project is somewhat large, but I will keep you posted.

Kind regards

Silke