Gossamer Forum
Home : Gossamer Threads Inc. : Custom Modification Jobs :

linkdup style category tree

Quote Reply
linkdup style category tree
$10-20

Please help, i'm trying to create a category tree like the way linkdup did in links 2.

checkout this link to see their tree.

http://www.linkdup.com/v1/pages//tree.html

Thank you!
Quote Reply
Re: [xpert] linkdup style category tree In reply to
Nobody can do this for me even for some cash?
Quote Reply
Re: [xpert] linkdup style category tree In reply to
Common, somebody pease help, i'm willing to pay a little more, just give me a quote?
Quote Reply
Re: [xpert] linkdup style category tree In reply to
Anyone, god damn it, nobody know how to do it even for CASH $$$$$$$?????
Quote Reply
Re: [xpert] linkdup style category tree In reply to
I'm assuming that all you want is a menu which has all the first level subcategories? If so, try this:

sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY full_name');
my $sth = $cat_db->select ( { FatherID => 0}, ['Full_Name','ID'] );
my $output="<table>";
while (my ($root_cat,$ID) = $sth->fetchrow_array) {
$output.="<tr><td>$root_cat</td></tr>";
my $sth2 = $cat_db->select ( { FatherID => $ID}, ['Full_Name','Name'] );
while (my ($cat,$short) = $sth2->fetchrow_array) {
my $url = $cat_db->as_url($cat);
$output .= qq~<tr><td><a href="$CFG->{build_root_url}/$url" class="toc"><b>$short</b></a></td></tr>~;
}
}

$output.="</table>";
return $output;
}

You'll need to play around with the presentation by modifying the html in red.
The UK High Street
Quote Reply
Re: [afinlr] linkdup style category tree In reply to
Hi Laura,

This global works perfectly fine, anyway do you know how to put the number of links next to each category like the way linkdup did it?

Last edited by:

xpert: Oct 20, 2002, 10:37 AM
Quote Reply
Re: [xpert] linkdup style category tree In reply to
sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY full_name');
my $sth = $cat_db->select ( { FatherID => 0}, ['Full_Name','ID'] );
my $output="<table>";
while (my ($root_cat,$ID) = $sth->fetchrow_array) {
$output.="<tr><td colspan=2>$root_cat</td></tr>";
my $sth2 = $cat_db->select ( { FatherID => $ID}, ['Full_Name','Name','ID'] );
while (my ($cat,$short,$id) = $sth2->fetchrow_array) {
my $link_count = $DB->table('CatLinks')->count ( {CategoryID => $id});
my $url = $cat_db->as_url($cat);
$output .= qq~<tr><td>$link_count</td><td><a href="$CFG->{build_root_url}/$url" class="toc"><b>$short</b></a></td></tr>~;
}
}
return $output;
}
The UK High Street
Quote Reply
Re: [afinlr] linkdup style category tree In reply to
Hi Laura,

Right now the list looks fine, except for that it seems too lobg since there's many subcats for each rootcat, anyway to break the list into 2 columns?
Quote Reply
Re: [xpert] linkdup style category tree In reply to
Not sure about this - I suppose the best way to do it would be to count all the subcats to begin with. You could try this but someone else may have a better suggestion. You will need to change the 30 in red to the number that you want in the first column.

sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options ('ORDER BY full_name');
my $sth = $cat_db->select ( { FatherID => 0}, ['Full_Name','ID'] );
my $output="<table><tr><td><table>";
my $i=0;
while (my ($root_cat,$ID) = $sth->fetchrow_array) {
$output.="<tr><td colspan=2>$root_cat</td></tr>";
my $sth2 = $cat_db->select ( { FatherID => $ID}, ['Full_Name','Name','ID'] );
while (my ($cat,$short,$id) = $sth2->fetchrow_array) {
$i++;
my $link_count = $DB->table('CatLinks')->count ( {CategoryID => $id});
my $url = $cat_db->as_url($cat);
$output .= qq~<tr><td>$link_count</td><td><a href="$CFG->{build_root_url}/$url" class="toc"><b>$short</b></a></td></tr>~;
if ($i eq '30'){ $output.="</table></td><td><table>";}
}
}
$output.="</table></td></tr></table>";
return $output;
}
The UK High Street