/
Function Field

Function Field

Imported From: http://groups.google.com/group/in-portal-bugs/browse_thread/thread/2a2ee5d35d079f8b#

V funkcii field db_tag_processor estj funkcionaljnost' pokaza X simvolov. (first_chars,cut_first) 

$first_chars = $this->SelectParam($params,'first_chars,cut_first'); 
if($first_chars) 
{ 
        $needs_cut = mb_strlen($value) > $first_chars; 
        $value = mb_substr($value, 0, $first_chars); 
        if ($needs_cut) $value .= ' ...'; 
} 

Dlja Vsex funkciy "mb_" neobxodimo vtorim parametrom peredavatj tekushju kodirovku, inache takie funkcii nepravilno schitajusj kolichesatvo simvolov pri ispolzoivanii jazika otlichnogo ot EN i posledniy simvol pered obrezkoy stroki pokazivajut v vide simpotichnoko kvadratika :) OSOBENNO v UTF-8 i UTF-16 (interesno kto nibudj ispoljzuet UTF-16 :) )

 Drugimi slovami nado dobavitj vtoroy parametr, v kotorm perdajetsja tekushaja kodirovka:

$needs_cut = mb_strlen($value,'utf-8') > $first_chars;