This hack allows you to use [declination=X][/declination] tags in all.tpl files of the template and makes a minor but convenient change to the operation of these tags.
Open index.php in the root of the site and find:
echo $tpl->result['main'];
Insert above:
$tpl->result['main'] = preg_replace_callback ( "#\\[declination=(\d+)\\](.+?)\\[/declination\\]#is", "declination", $tpl->result['main'] );
Open File engine/modules/functions.php and find:
return $matches[1]." ".$word;
Replace with:
return $word;
Done.
Now I will tell you about the change in the operation of these tags.
If you use such a construction:
You have [declination={new-pm}]reported|s|s/s[/declination]
Then the result on the page will look like this:
You have 10 messages
This hack removes the number and the space between the word, leaving only the declined word, creating the need to write a numeric tag additionally. Thus, it allows you to use more complex constructions of this type:
You have {new-pm} [declination={new-pm}]new|oe|s|s[/declination] [declination={new-pm}]reported[/declination]
The result on the page will look like this:
You have 10 new messages
Who did not understand, without revision - it would look like this:
You have 10 10 new 10 messages
I hope it will be useful in your projects ;)
Thank you for your attention!