Hacks: „Browse in alphabetical order“ in the lexicon and national characters

Posted by: ZirafkaOn 2010/1/8 15:20:00 8295 reads
If you want the module "Lexicon" show national characters in the block „Browse in alphabetical order“, you have a problem. The solution is simple:

In file INCLUDE/FUNCTION.PHP search:

function lx_alphaArray ()
    {
    global 
$xoopsUser$xoopsDB$xoopsModule;
    
$alpha = array();
    for (
$a 65$a < (65+26); $a++ )
        {
        
$letterlinks = array();
        
$initial chr($a);
        
$sql $xoopsDB -> query "SELECT * FROM " $xoopsDB -> prefix "lxentries") . " WHERE init = '$initial' " );
        
$howmany $xoopsDB -> getRowsNum$sql );
        
$letterlinks['total'] = $howmany;
        
$letterlinks['id'] = chr($a);
        
$letterlinks['linktext'] = chr($a);

        
$alpha['initial'][] = $letterlinks;
        }
    return 
$alpha;
    }


And replace:

function lx_alphaArray (){

        global 
$xoopsUser$xoopsDB$xoopsModule;
        
$pismenka = array("A","B","C","D","E","F","G","H","CH","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
        
$alpha = array();

    for (
$a 0$a count($pismenka); $a++ )
       {
                                                                     
        
$letterlinks = array();
        
$initial =  $pismenka[$a];
        
$sql $xoopsDB -> query "SELECT * FROM " $xoopsDB -> prefix "lxentries") . " WHERE init = '$initial' " );
        
$howmany $xoopsDB -> getRowsNum$sql );
        
$letterlinks['total'] = $howmany;
        
$letterlinks['id'] =  $pismenka[$a];
        
$letterlinks['linktext'] =  $pismenka[$a];

        
$alpha['initial'][] = $letterlinks;
        }


    return 
$alpha;
    }



Array $pismenka[] include list of characters, who module use, simply use your national characters.

Hack is tested in Xoops 2.4.2 and 2.4.2 in UTF-8.

That’s all, Happy Xoopsing