Mamba you show the community we can always find a better solution for the same obstacle.
Actually any developer can find a solution but the first solution is not always the best solution.
IMO to add feature/solve a bug, this priority should be followed by all developers in all modules/core
1- user side codes.
As a developer/debugger you should always try to find a user side solution. it is much better than manipulating php codes.
1-1- css: CSS is the best choice. You should always try to find a solution using css
pros: it is OS/Browser independent. even a very simple webmaster knows some css codes. It is local aware and multilingual.
cons: Nothing
1-2- html: It is good in combine with css
1-3- smarty: it is the third choice if you can not solve the issue using css/html
cons: it is not local aware. Xoops maybe use another template engine in the future.
1-4- javascript: it is the last resort in user side programming.
big disadvantage: user may turn the js off in the browser.
2- server side codes.
2-1- php: try to hack php codes only if you could not find a solution using css/html/smarty/js
2-2- mysql: altering/changing database is the last resort
It maybe time consuming to try to find a solution in all above ways but the outcome is best.
ok back to this issue Mamba raised, we can follow the above protocol.
1- css:
there is a solution you can use overflow: hidden;
.truncate {
overflow: hidden;
}
then in template:
<div class="width10 truncate">
<{$download.title}>
div>
pros: it is local aware and multilingual
cons: it can not recognize letters. so maybe you end up with a part of the last letter show up.
2- smarty (Mamba stated)
<{$download.title|truncate:11:"":true}>
cons: it is not local aware. it cannot be used in 2-byte languages like persian.
3- php (zyspec stated)
IMO it is better to use the class directly because in xoops 2.6 these kind of functions will be removed.
XoopsLocal::substr($title, 0, 11, "");
IMO the css solution is the best one.