Gossamer Forum
Home : Products : Links 2.0 : Customization :

SUBCATEGORIES LIKE YAHOO v2.1

(Page 6 of 6)
> >
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
holy moly, right now i'm lost! can someone make a final Yahoo mod where everything we need to do is in it? no linking to other webpages. like everything is there that needs to be done? it's all too overwhelming for me to read all these scattered messages. i'm not mad, just confused.

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Glennu already re-wrote this Mod and provided two pages of instructions, one that can be found at:

http://cgi-resource.co.uk/pages/subcat.shtml

and if you go to:

http://cgi-resource.co.uk/pages/

you will see tons of other mods you can add to Links 2.0.

BTW: Glennu did post a link to the above pages quite a few times in this forum...Wink

Regards,

Eliot Lee
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
yeah, thanks. but i have several problems with it. i installed the category link template mod and because of that i could not go ahead and install glenn's mod. is there a way around this? it involves a modification i made in site_html_templates:

to sub site_html_print_cat

wherein i replaced:

# 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>|;


with:

%cat_rec = (url => $url,
numlinks => $numlinks,
category_name => $category_name,
description => $description,
new => $new
);
if (&days_old($mod) < $db_new_cutoff) {$cat_rec{'new'} = 1}
if ($cat_rec{'description'} !~ /^[\s\n]*$/) {delete: $cat_rec{'description'}}
$output .= &site_html_category_link;

glenn requires me to do this:

Go to the print cat sub and find:

$output .= qq|<dd><span class="descript">$description </span></dd>| if (!($description =~ /^[\s\n]*$/));

Replace it with:

$output .= qq|<dd><span class="descript">$description</span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|<dd><span class="descript">$subcats</span></dd>|;

any thoughts?

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Drewboy,

Yes, the category template mod was not intended for use with any other mods, especially Subcategories Like Yahoo... If you give me some time, I can make a modified version that will work with Glennu's subcategory mod.


Everyone else,

There seems to be quite a bit of problems with this mod. Mostly, the original instructions are a bit incorrect and vague. Most users had a problem with a missing bracket at about line 450. Corrected versions have been posted (and lost over time). Here is a (another) working copy of Subcategories Like Yahoo 2.1:
Code:
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);
my ($half) = int (($#subcat+2) / 2);

# Print Header.
$output = qq|<div class="margin"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;

foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
($subcatstyle) = @{$category{$subcat}}[8];

# 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"}[1];

# 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++;

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<a class="catlist" href="$url">$category_name</a> <font class="catlist">($numlinks)</font> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<BR>|;

if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {
($subcatstyle, $style) = ($1, $2);
$s = 0;
@subcatsub = split (/\|/, $subcatstyle);
$output .= qq~ ~ if ($style eq "1");
foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
($subcatstyle eq "ALL" && $#subcatsub == 0) ?
($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
($_ eq "$subcat/$category_name" or next);
if ($style eq "1") {
$length += length($category_name);
($length > $subcat_length) and last;
}
if ($s > 0) {
$output .= qq~, ~ and $length += 2 if ($style eq "1");
$output .= qq~ ~ if ($style eq "2");
}
$url = "$build_root_url/" . &urlencode($_) . "/";
$output .= qq~<LI>~ if ($style eq "2");
$output .= qq~<a class="subcat" href="$url">$category_name</a>~;
$s++;
last if ($subcatstyle ne "ALL" && $#subcatsub > 0);
}
}
undef $length;
if ($s < $#{$subcategories{$subcat}}) {
$output .= qq~...~ if ($style eq "1");
}
$output .= qq~<BR>~;
}
else {
}
}

# Don't forget to end the table..
$output .= "</td></tr></table></div>\n";
return $output;
}
--Drew
Links 2.0 stuff
http://www.camelsoup.com
Quote Reply
Re: [PerlFreak] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Wished I had seen this link earlier ... errr ... I figured out basically what PerlFreak has posted here but I'd like to get the subcats to show the number of links listed and not show if there are no links.

Subcats not showing doesn't seem to be a problem but if even if only " 1 " link exists all subcats show .... Frown

next hopeful is how do you get the number of links per cat to show?

obviously:
$output .= qq~<small><a href="$url">$category_name</a></small> <small class="numlinks">($numlinks)</small>~;

only prints out the total of links for the either the whole category area or comes from the total of subcats ...

Any ideas?

openoffice + gimp + sketch ... Smile
Quote Reply
Re: [phandsome] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hello,
I did every thing you said and it is working fine, but the categories and subcategories are in the same font size on my catlist output, I'm using templates and my own CSS, and I want to know, (I'm not good on perl) where can I define the font class for subcategories in this mod. I want subcategories in a smaller size. I have created a .class subcat on my CSS. but...


Thanks. (sorry for my english)
Adriana de Hoyos
Quote Reply
Re: [imagenym] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
try changing this area, it's only really html to deal with ... ....

<small><a href="$url">$category_name</a></small>

this is from the lines in the actual print subcat area ....

$url = "$build_root_url/" . &urlencode($_) . "/";
$output .= qq~<LI>~ if ($style eq "2");
$output .= qq~<small><a href="$url">$category_name</a></small>~;


you can also change out the <small> to something like ....

$output .= qq~<a class="what_you_called_your_class" href="$url">$category_name</a>~;

I'm not sure how browser independant that is though ...

good luck

----------------------------------------

anybody for printing out numlinks at the same line ????


openoffice + gimp + sketch ... Smile
Quote Reply
Re: [QooQ] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
In Reply To:
try changing this area, it's only really html to deal with ... ....

<small><a href="$url">$category_name</a></small>

this is from the lines in the actual print subcat area ....

$url = "$build_root_url/" . &urlencode($_) . "/";
$output .= qq~<LI>~ if ($style eq "2");
$output .= qq~<small><a href="$url">$category_name</a></small>~;


you can also change out the <small> to something like ....

$output .= qq~<a class="what_you_called_your_class" href="$url">$category_name</a>~;

I'm not sure how browser independant that is though ...

good luck

----------------------------------------

anybody for printing out numlinks at the same line ????
I am trying to do something similar to this but I cant get it to work right. I want to have the main categories in bold but keep the subcats non bold. How can I do this?
Quote Reply
Re: [rc] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
You might take a look at this thread

http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=176828;search_string=search_string;guest=168495#176828
Quote Reply
Re: [memobug] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Tell me in what a problem, what I have made so?
Has established MOD, but subcategory are not displayed.
http://eston.net/katalog

Thank!
Quote Reply
Re: [Kraken] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I've installed everything I think..

However, when attempting to build, i get the following error:

Error including libraries: Unmatched right curly bracket at /home/virtual/site18/fst/var/www/cgi-bin/links/admin/site_html_templates.pl line 452, at end of linesyntax error at /home/virtual/site18/fst/var/www/cgi-bin/links/admin/site_html_templates.pl line 452, near "}"Compilation failed in require at nph-build.cgi line 33.Make sure they exist, permissions are set properly, and paths are set correctly. Anyone have any Ideas?
Quote Reply
Re: [JackBeQuick] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
1) Go back to your original set of your files (before you attempted to add the mod).

2) Then (like I posted a year ago), use GLENNU's MOD:

http://cgi-resource.co.uk/pages/subcat.shtml

It is better written and should be easier to install.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hello - I got this mod to working without any problems:

GLENNU's MOD:
http://cgi-resource.co.uk/pages/subcat.shtml

However, I don't anything on how to change how many of the subcats actually display on the page. I don't want to list them all just a sampling. Can I limit the number of subcats displayed? How about the length of characters displayed?

Ooop's - ok, I found how to limit the characters of the subcat. But my question now is this. Say my subcat_length is set to 50 and at 50 instead of it just stopping... is there a way for it to print "..." indicating that there are more sub categories available than what appears on the page?

Thanks!

Last edited by:

donm: Jan 6, 2006, 12:25 PM
Quote Reply
Re: [donm] SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Try the mod I linked in your other post. The 50 is the maiximum length pf the category: 50 charcters. The mod you looked does add the ...


Leonard
aka PerlFlunkie
> >