1
chnwalkman
about Smartsection 2.13 block -- Please help

I have downloaded smartsection 2.13 final and tested it on XOOPS 2.0.16/2.2.5. When I set title length option in the "recent and new items blocks" met a problem.

When XOOPS default language is "English", the title shows OK in the recent and new items blocks, it is interrupted according to my setting (it's by "..." ending).

But when I set language to "Chinese" by "Preferences Main / General Settings", the title length is invalid in that block. Whether I set how much characters, the item title always complete display in the "recent and new items blocks" at my homepage. How can I fix it?

Please help. Thank you.

2
lovemp3
Re: about Smartsection 2.13 block -- Please help
  • 2008/9/11 6:15

  • lovemp3

  • Just popping in

  • Posts: 2

  • Since: 2008/9/10


I have the same problem.
Does anyone know how to fix it?

I appreciate your help.

3
chnwalkman
Re: about Smartsection 2.13 block -- Please help

lovemp3, have you fixed that problem above it?

4
Catzwolf
Re: about Smartsection 2.13 block -- Please help
  • 2009/3/4 3:24

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


There should be an option either in the block options for that block, to shorten block titles to a certain length. If the block has this turned on, turn it off and you will sort this problem.

Problem is that this doesn't deal with multibyte chars as expected.

5
chnwalkman
Re: about Smartsection 2.13 block -- Please help

Thank you, catzwolf.

Yes, I set that "Length of the title" option in the recent items block. Maybe it cannot support multi-byte languages perfectly.

6
Catzwolf
Re: about Smartsection 2.13 block -- Please help
  • 2009/3/4 3:46

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


I'm not sure that you can just cut off titles like that in multi-byte languages? but, we can try and make sure that if the language is multi-byte, then we will just bypass this and show the title as full. Unless someone can tell me differently of course :)

Catz

7
trabis
Re: about Smartsection 2.13 block -- Please help
  • 2009/3/4 14:02

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


ohwada has submit fixes for this.

Look here:
http://sourceforge.jp/projects/xoops4u/releases/33279

8
chnwalkman
Re: about Smartsection 2.13 block -- Please help

Thank you, trabis. But ohwada's patch can't slove my problem. It has not included the fix about to interrupt the title for multibyte language.
Quote:

(1) enable \"Print\" and \"PDF\"
(2) Parse error and Notice in print
(3) wrong style in print template file
(4) Invalid argument when guest view
(5) Undefined variable in admin\'s category
(6) Missing argument when save file
(7) many Notice when \"Disable comments\"
(8) keyword \"abc\" match \"abccccc\"
(9) cannot show keyword in Japanese and multibyte language

9
trabis
Re: about Smartsection 2.13 block -- Please help
  • 2009/3/5 13:56

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


I see the problem now, I'll see what I can do.

10
trabis
Re: about Smartsection 2.13 block -- Please help
  • 2009/3/5 20:28

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Let us try this:

Open smartsection/class/item.php an replace by this(around line 171):
function title($maxLength=0$format="S")
    {
        
$ret $this->getVar("title"$format);
        if ((
$format=='s') || ($format=='S') || ($format=='show')) {
            
$myts = &MyTextSanitizer::getInstance();
            
$ret $myts->displayTarea($ret);
        }

        if (
$maxLength != 0) {
            if (
mb_strlen($ret_CHARSET) >= $maxLength) {
                    
$ret smartsection_substr($ret 0$maxLength);
            }
        }

        return 
$ret;
    }


Now edit smartsection/include/functions.php and replace by this(around line 145)
// Thanks to Mithrandir :-)
function smartsection_substr($str$start$length$trimmarker '...')
{
    
// if the string is empty, let's get out ;-)
    
if ($str == '') {
        return 
$str;
    }

    
// reverse a string that is shortened with '' as trimmarker
    
$reversed_string strrev(xoops_substr($str$start$length''));

    
// find first space in reversed string
    
$position_of_space mb_strpos($reversed_string" "0_CHARSET);

    
// truncate the original string to a length of $length
    // minus the position of the last space
    // plus the length of the $trimmarker
    
$truncated_string xoops_substr($str$start$length-$position_of_space+mb_strlen($trimmarker,_CHARSET), $trimmarker);

    return 
$truncated_string;
}

Did not tested itplease report back.

Login

Who's Online

113 user(s) are online (68 user(s) are browsing Support Forums)


Members: 0


Guests: 113


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits