1
Wheeler
Layout (Browse Downloads by alphabetical listing)
  • 2005/2/5 16:42

  • Wheeler

  • Not too shy to talk

  • Posts: 145

  • Since: 2004/10/29


I have done search and found one result so this has not been asked. (My Search: "$letterchoice")

What I want to do is change the layout of the alphabet in wf-downloads. Currently shows 36 characters in 2 rows, 19 in 1st row and 17 in 2nd row. I want it to display 4 rows with 9 characters in each.

The changes must be made to this code from "/include/functions.php"
function wfd_letters()
{
    global 
$xoopsModule;

    
$letterchoice "";
    
$letterchoice .= "[  ";
    
$alphabet = array ("A""B""C""D""E""F""G""H""I""J""K""L""M""N""O""P""Q""R""S""T""U""V""W""X""Y""Z""0""1""2""3""4""5""6""7""8""9");
    
$num count($alphabet) - 1;
    
$counter 0;
    while (list(, 
$ltr) = each($alphabet))
    {
        
$letterchoice .= "<a href='" XOOPS_URL "/modules/wfdownloads/viewcat.php?list=$ltr'>$ltr</a>";
        if (
$counter == round($num 2))
            
$letterchoice .= " ]<br />[ ";
        elseif (
$counter != $num)
            
$letterchoice .= "&nbsp;|&nbsp;";
        
$counter++;
    } 
    
$letterchoice .= " ]";
    return 
$letterchoice;
}

As you can see I already moved the numbers after the letters so it would display nicely in 4 rows.

I have played with this code for 2 hours and it will not work. It is not the same as the "<{if $category.count is div by 2}>" sort of idea. Now am asking for assistance.

Thank you for your time.

2
Wheeler
Re: Layout (Browse Downloads by alphabetical listing)
  • 2005/2/5 18:17

  • Wheeler

  • Not too shy to talk

  • Posts: 145

  • Since: 2004/10/29


*BUMP*

Anybody have an idea? I have done many bug fixes and designed new templates for this module. I need this nav menu to display as described above for the new templates.

Please Help!

3
Wheeler
Re: Layout (Browse Downloads by alphabetical listing)
  • 2005/2/6 1:17

  • Wheeler

  • Not too shy to talk

  • Posts: 145

  • Since: 2004/10/29


I viewed the source of the page, copied the html to the template, and arranged it the way I want.

It Looks Great!

4
Wheeler
Re: Layout (Browse Downloads by alphabetical listing)
  • 2005/2/6 2:50

  • Wheeler

  • Not too shy to talk

  • Posts: 145

  • Since: 2004/10/29


Here is the new code for a different layout of the alphabet navigation menu.

The changes must be made to this code from "/include/functions.php"
function wfd_letters()
{
    global 
$xoopsModule;

    
$letterchoice "<div>" _MD_WFD_BROWSETOTOPIC "</div>";
    
$letterchoice .= "[  ";
    
$alphabet = array ("0""1""2""3""4""5""6""7""8""9""A""B""C""D""E""F""G""H""I""J""K""L""M""N""O""P""Q""R""S""T""U""V""W""X""Y""Z");
    
$num count($alphabet) - 1;
    
$counter 0;
    while (list(, 
$ltr) = each($alphabet))
    {
        
$letterchoice .= "<a href='" XOOPS_URL "/modules/wfdownloads/viewcat.php?list=$ltr'>$ltr</a>";
        if (
$counter == round($num 2))
            
$letterchoice .= " ]<br />[ ";
        elseif (
$counter != $num)
            
$letterchoice .= "&nbsp;|&nbsp;";
        
$counter++;
    } 
    
$letterchoice .= " ]";
    return 
$letterchoice;
}


Now replace it with this code
function wfd_letters()
{
    global 
$xoopsModule;

    
$alphabet array_merge(range('A''Z'), range('0''9'));
    
$letterchoice "<b>" _MD_WFD_BROWSETOTOPIC "</b>";

    for (
$i 0$cnt count($alphabet); $i $cnt$i++) 
    {
       if (
== ($i 9) && (strlen($letterchoice) > 2)) 
           
$letterchoice .= '<br>|';
       
$letterchoice .= " <a href='" XOOPS_URL "/modules/wfdownloads/viewcat.php?list={$alphabet[$i]}'>{$alphabet[$i]}</a> |";
    }

    return 
$letterchoice;
}


It works like a charm! For those of us who customize our modules, this new layout is a box and fits nicely in a narrow column.

This is what it should look like.
Quote:
Browse Downloads by alphabetical listing
| A | B | C | D | E | F | G | H | I |
| J | K | L | M | N | O | P | Q | R |
| S | T | U | V | W | X | Y | Z | 0 |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |


I will post this hack in a more appropriate place. Enjoy!

5
Wheeler
Re: Layout (Browse Downloads by alphabetical listing)
  • 2005/2/6 6:17

  • Wheeler

  • Not too shy to talk

  • Posts: 145

  • Since: 2004/10/29


I edited my post above with better code for you to paste. There was some messy code posted for a while. If you tried the hack and it did not work, please try it again.

Login

Who's Online

248 user(s) are online (166 user(s) are browsing Support Forums)


Members: 0


Guests: 248


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