4

I have a Joomla 2.5 multilingual website (ua,ru,en).

I want to change a function, which is responsible for article output. This function should trim content (db column introtext table _content) by tags <ua>/<ru>/<en> and output only that part of article, which is enclosed in tags <en></en> for english, <ua></ua> for ukrainian, <ru></ru> for russian. So:

Result articles should look like:

<ua>bla blah</ua><ru>ololo lorem ipsum</ru><en>hello world!</en>

Then function should check $_SERVER['REQUEST_URI'] and put language in $lang variable.

After that function should delete all code from introtext column except that is enclosed in <$lang></$lang> tags.

Can you help me to find where function of article output is?

1
  • 1
    It looks like you are not using the build-in multilanguage feature in Joomla. Sep 22, 2014 at 16:32

3 Answers 3

3

You might want to take a look at an extension called "Easy Language". I haven't tried it myself, but according to the description it does exactly what you want (except the tags are a little different). In your case, your article would look like this:

{lang ua}bla blah{/lang}
{lang ru}ololo lorem ipsum{/lang}
{lang en}hello world!{/lang}

If you want to override the article output, you can create an override:

Copy the file JOOMLAROOT\components\com_content\views\article\tmpl\default.php to \templates\YOURTEMPLATE\html\com_content\article\default.php and edit the file as needed.

0
2

Thanks, johanpw!
Next code solved my task:

$lang = substr($_SERVER['REQUEST_URI'],1,2); echo substr($this->item->text, strpos($this->item->text,'{'.$lang.'}')+4, strpos($this->item->text,'{/'.$lang.'}') - strpos($this->item->text,'{'.$lang.'}')-4);

...instead of:
echo $this->item->text;

P.S. I promise that I'll try to make some plugins in future.

0

It seems that you will need to develop a content plugin for this and use onContentPrepare event to modify the output for your needs.

2
  • I don't know how to develop plugins and never did this before. I just want you to help me find code, which is responsible for article output. Plugin development will help others, but I think I can't do this now.
    – Alukret
    Sep 22, 2014 at 13:47
  • Writing plugins is easier that you think. Anyway @johanpw pointed you to the plugin and code ;) Sep 22, 2014 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.