DLE hacks
We change the annoying xfsearch in the address to a more logical word
26-12-2022, 12:23
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!
26-12-2022, 12:23
26-12-2022, 14:35
26-12-2022, 11:51
There are no comments
Information
Users of Visitor are not allowed to comment this publication.