Using tags [declination = X] [/ declination] in all .tpl template files and a slight change in the Tag DLE 10.1 - 10.x
This hack allows you to use tags [declination = X] [/ declination] in all .tpl template files and makes a small but convenient change in the work of these tags.
Installation:
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;
Finish.
Now talk about the change in the work of these tags.
If you use such a structure:
You [declination={new-pm}]message|e|i|s[/declination]
The result on the page will look like this:
You [declination={new-pm}]message|e|i|s[/declination]
This hack removes the number and space between the word, leaving only the word declination, creating a need to write a numeric tag further. Thus allows the use of more complex structures like this:
You {new-pm} [declination={new-pm}]new|th|s|s[/declination] [declination={new-pm}]reported|s|th|s[/declination]
The result on the page will look like this:
You have 10 new messages
Who do not understand, without elaboration - it would look like this:
Do you 10 10 10 new posts
Hope will be useful in your own projects;)
Thank you for your attention!
Author: vir2oz
Version DLE: 10.1 - 10.x
Aucun commentaire:
Enregistrer un commentaire