The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
substr is BAD! fetch_trimmed_title is GOOD!
A little note for all coders.
I was inspecting MOD: Cyb - Advanced Forum Statistics https://vborg.vbsupport.ru/showthread.php?t=122986 And saw that php's substr(); function is used there. For example: PHP Code:
You have to use fetch_trimmed_title(); function which is built-in vbulletin. You asked why? 1-st, VB's uses this function to cut thread titles. 2-nd, most forum uses UTF8. For example Russian letter in UTF-8 will look like: PHP Code:
So when you type some word in Russian which consists of 5 letter it will look like: PHP Code:
And in this way it is storied in databse. So it it 30 symbols if you count. When you use substr(); function you cut by symbols and not by letters! So if you set to with substr(); function to cut after 27 letter and you will cut the example above you will get: PHP Code:
And when this one will be displayed on the webpage you will see a bug. That is why you have to use fetch_trimmed_title(); function. As it cuts only whole words. fetch_trimmed_title() relies on spaces when cutting. If me return to Cyb - Advanced Forum Statistics https://vborg.vbsupport.ru/showthread.php?t=122986 in all code I replaced lines like: PHP Code:
PHP Code:
functions.php PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|