1
mouacy
PDdownloads function for alphabetical letter not working right
  • 2007/3/5 5:50

  • mouacy

  • Not too shy to talk

  • Posts: 138

  • Since: 2002/11/2


Original code:

function PDd_letters()
{
    global 
$xoopsModule;
    if (empty(
$mydirname)){
        include 
'mydirname.php';
    }

    
$letterchoice = "<div>" . _MD_PDD_BROWSETOTOPIC . "</div>";
    
$letterchoice .= "[  ";
    
$alphabet = PDd_getLetters();
    
$num = count($alphabet) - 1;
    
$counter = 0;
    while (list(, 
$ltr) = each($alphabet))
    {
        
$letterchoice .= "<a href='" . XOOPS_URL . "/modules/[b]$mydirname[/b]/viewcat.php?list=$ltr'>$ltr</a>";
        if (
$counter == round($num / 2))
        
$letterchoice .= " ]<br />[ ";
        elseif (
$counter != $num)
        
$letterchoice .= "&nbsp;|&nbsp;";
        
$counter++;
    }
    
$letterchoice .= " ]";
    return 
$letterchoice;
}

Link on alphabet shows: http://www.mydomain.com/modules//viewcat.php?list=alphabet

The module name does not show.

So I have to hardcode in the module name PDdownloads to make it work.

$letterchoice .= "<a href='" . XOOPS_URL . "/modules/[b]PDdownloads[/b]/viewcat.php?list=$ltr'>$ltr</a>";

Any other idea on how to fix this?