A few of you probably knows my way of customizing the look of individuals blocks by giving them a custom title (posted here:
https://xoops.org/modules/newbb/viewtopic.php?post_id=265122#forumpost265122 )
With this method I can name (title) blocks like
green-block + whatever title needed
red-block + whatever title needed
blue-block + whatever title needed
And those 3 blocks will look completely different (just by giving them a few characters in the begining of their title) ... via CSS and/or HTML each of those block can look different (so you can make a few "reusable blocks types" and use them whenever needed in your site blocks )
Well - this method won't work with UTF-8 (default in 2.3.x) since the smarty "truncate" is not working with UTF-8
I use this method a lot to give a few of my front-page blocks a unique look
( breaking the XOOPS look a bit )
There is a way to do it in UTF-8 too ( adding a smarty plugin to /xoops/class/smarty/plugins/ )
make a new file ( /class/smarty/plugins/modifier.mb_truncate.php ) with this code:
<?php /** * Smarty plugin * @package Smarty * @subpackage plugins */ /** * Smarty truncate modifier plugin * * Type: modifier<br> * Name: mb_truncate<br> * Purpose: Truncate a string to a certain length if necessary, * optionally splitting in the middle of a word, and * appending the $etc string or inserting $etc into the middle. * This version also supports multibyte strings. * @link http://smarty.php.net/manual/en/language.modifier.truncate.php * truncate (Smarty online manual) * @author Guy Rutenberg <guyrutenberg@gmail.com> based on the original * truncate by Monte Ohrt <monte at ohrt dot com> * @param string * @param integer * @param string * @param string * @param boolean * @param boolean * @return string */ function smarty_modifier_mb_truncate($string, $length = 80, $etc = '...', $charset='UTF-8', $break_words = false, $middle = false) { if ($length == 0) return ''; if (strlen($string) > $length) { $length -= min($length, strlen($etc)); if (!$break_words && !$middle) { $string = preg_replace('/s+?(S+)?$/', '', mb_substr($string, 0, $length+1, $charset)); } if(!$middle) { return mb_substr($string, 0, $length, $charset) . $etc; } else { return mb_substr($string, 0, $length/2, $charset) . $etc . mb_substr($string, -$length/2, $charset); } } else { return $string; } } /* vim: set expandtab: */ ?>
..... I'll post the rest in here in an hour since I've been called in the middle of my post