Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
Old 2008-09-05, 12:24 PM   #9
HC-Majick
You can now put whatever you want in this space :)
 
HC-Majick's Avatar
 
Join Date: Oct 2004
Location: Upstate NY
Posts: 541
Send a message via ICQ to HC-Majick
This should give you the 4 columns...
Code:
########################################################################################
# THE FOLLOWING DETERMINES YOUR CATEGORY LISTING, IT'S NOT TEMPLATE BASED (YET)!       #
########################################################################################

sub site_html_print_cat {
# --------------------------------------------------------
# This routine determines how the list of categories will look.
# We now use a table to split the category name up into two columns.
# For each category you can use the following variables:
#
#   $url        : The URL to go to that category
#   $category_name : The category name with _ and / removed.
#   $category_descriptions{$subcat}: The category description (if any).
#   $numlinks   : The number of links inside that category (and subcategories).
#   $mod        : The newest link inside of that category.
#

    my (@subcat) = @_; 
    my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
  $columns = '4'; #number of columns
my ($half) = int (($#subcat+2) / $columns);

    # Print Header.
    $output = qq|<div class="margin"><table width="90%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;
    
    foreach $subcat (sort @subcat) { 
        ($description) = @{$category{$subcat}}[2];
        
# First let's get the name, number of links, and last modified date...  
        $url = "$build_root_url/" . &urlencode($subcat) . "/";
        if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
        $numlinks = $stats{"$subcat"}[0]; 
        $mod = $stats{"$subcat"}[2];

# We check to see if we are half way through, if so we stop this table cell
# and begin a new one (this lets us have category names in two columns).        
  if ($i == $half) {
$output .= qq|</td><td class="catlist" valign="top">\n|;
$i = 0; }
       
        }
        $i++;
        
# Then we print out the name linked, new if it's new, and popular if its popular.
        $output .= qq|<dl><dt><strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
        $output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
        $output .= qq|</dt>|;
        $output .= qq|<dd><span class="descript">$description </span></dd>| if (!($description =~ /^[\s\n]*$/));
        $output .= qq|</dl>|;        
    }

# Don't forget to end the unordered list..
    $output .= "</td></tr></table></div>\n";
    return $output;
}

sub html_escape {
    my $escape = shift;
    $escape =~ s/&/&amp;/g;
    $escape =~ s/</&lt;/g;
    $escape =~ s/>/&gt;/g;
    $escape =~ s/"/&quot;/g;
    return $escape;
}

1;
__________________
Submit Your Freesites:
HC-Majick is offline   Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:26 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc