Gossamer Forum
Home : Products : Links 2.0 : Customization :

SUBCATEGORIES FOR LINKS MOD

(Page 1 of 3)
> >
Quote Reply
SUBCATEGORIES FOR LINKS MOD
Although this came out like 2 or 3 weeks ago, I finally came out with the version that I am satisfied with.

What still "sucks" about the mod is that you cannot "choose" which sub categories to list.. it simply lists them in alphabetical order.

The mod now supports templates.. (using similar code)..

It also limits the number of characters that appear on the SUB1 feature...

SUB1:

Category
subcat1, subcat2, subcat3...

SUB2:

Category
subcat1
subcat2
subcat3
subcat4

For Non-Templates,
www.widgetz.com/links-mod.html

For Templates,
www.widgetz.com/links-templates-mod.html

Hope you guys like it! I am posting it in the resources section too..
Jerry

Yes.. This post is a continuation of:
www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/001878.html

I just thought it looked better with MOD behind it Wink

[This message has been edited by widgetz (edited July 08, 1999).]
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
If you install this.. Can you post a message here telling me how "hard" or how "easy" it was to install.. and if you messed up? Smile

Cause I got 66th percentile in Language class and 74th percentile in Reading and it might be hard to understand my instructions .. hehe

But I got 99th percentile in math.. lol Smile
(hehe.. my grade printout said 100%.. lol but of course.. it's only Algebra.. Smile)
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
I do it, but it doesn't work with
nonenglish modification... please help me...

------------------
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
give me the url to the non-english mod and your site.. i need to look at what it does and what the mod does..

also.. give me an explanation of how it doesn't work..

jerry
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Hi, in the last week, i had also tried to install the yahoo subcategories mod, but i figured out that it doesn't work with the nonEnglish mod too.

The problem with it, that it present the subcategories in the directory name, which is in english, and not in My NonEnglish name(hebrew).

P.S

you can find the NonEnglish mod in the following URL:

http://www.gossamer-threads.com/scripts/resources/jump.cgi?ID=54
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
hm.. i do not quite understand the mod.. but try this first..

in my mod.. find the line (first line, actually):

Code:
foreach $subcatsub (sort @{$subcategories{$subcat}}) {

and then add this right after...

Code:
($nonenglish) = @{$category{$subcatsub}}[8];
$subcategory_name = $nonenglish if ($nonenglish);

that should work...
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Hi, I has tried to change this modification for the NonEnglish, as you told me, but it didn't effect anithing, it's steel present the subcategories in english.
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
hi..

first try and change those 2 lines to:

Code:
($nonenglish) = @{$subcategories{$subcatsub}}[8];
$subcategory_name = $nonenglish if ($nonenglish);

if that doesn't work.. then you might as well contact matthais.. (i beleive he is the person that made the non english mod..)

he should understand his mod more than I could.. obviously Smile
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
ok.. i was editing the html page and i figured it out.. hehe..

Code:
($nonenglish) = @{$category{$subcatsub}}[8];
$subcatsub = $nonenglish if ($nonenglish);

now that should work.. hehe
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Greetings Widgetz and others.

I use snap clone templates - to make the modifications was easy and your instructions were very easy to follow.

However on rebuilding it showed up under the category the word sub2 instead of the actual subcategory. It also altered the font used for both main and sub category and used the word new instead of our new gif.


What I would like to do is what Aaron did on his site. He uses Alex's templates which has three columns which makes a bit of difference when using the mod.

Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Did you put "sub2" in the category description or "SUB2" ? It has to be all CAPS.

FYI---------------------------FYI

The code I use in my site_html_tmplates.pl is as follows: (this is a slight alteration of widgetz code. I notice this version was not listed in the new posted mod.)

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);
my ($half) = int (($#subcat+3) / 3);

# Print Header.
$output = qq|<div align="center"><table border="0" cellspacing="0" cellpadding="12" width=""><tr><td valign="top" width="">\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"}[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 valign="top" width="">\n|;
$i = 0;
}
$i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<font face="Verdana, Helevtica, Arial" size=3><b><a href="$url">$category_name</a></b></font>|;
my $days_old = &days_old($mod);
if ($days_old <= 2) { $output .= qq| $new_1|; }
elsif ($days_old <= 7) { $output .= qq| $new_3|; }
elsif ($days_old <= 14) { $output .= qq| $new_7|; }
$output .= qq|<br><font face="Verdana, Helevtica, Arial" size=1>(There are $numlinks links in this category)</font><BR>|;
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~$form_font <FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"> <option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~ </select></form>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
elsif ($description =~ /^SUB.*/) {
$output .= qq~$form_font <FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/);
$output .= qq~<option value="">None </select></form>~ if ($description =~ /3$/);
}
else {
$output .= qq~<dd>$form_font $description</font>~ if (!($description =~ /^[\s\n]*$/));
}
}

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


ALSO

I added the following to my header:

Code:
<script language="JavaScript">

function formHandler(form){
var URL = form.site.options[form.site.selectedIndex].value;
window.location.href = URL;
}
</script>

Aaron

------------------
www.serve.com/garden/geosearcher





[This message has been edited by Aaron (edited July 17, 1999).]
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
uhh.. my mod doesn't affect the new..

did you enter SUB2 or sub2?

jerry
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Greetings Aaron and Jerry !

On Jerry mod I entered sub2 not SUB2.. I will watch that next time round Smile I have emailed Aaron Jerry as it is his mod I would like to use.

Many thanks for all the help..This sub category thingy I think should be something standard to LINKS.



------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory



[This message has been edited by Ian Conza (edited July 15, 1999).]

[This message has been edited by Ian Conza (edited July 15, 1999).]
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Greetings Aaron!

I have installed the mod and added to the header of my home.html file the script you gave and when I run build this is the error.. I have gone through the code line by line to make sure it is right - cannot do much wrong with copy and paste though.

Error including libraries: syntax error at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 416, near "elsif"

Make sure they exist, permissions are set properly, and paths are set correctly.

Not being a script whizz I have no idea what is wrong.. Is it because I am using it on snap templates? Frown



------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory

Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Two things to try...
1. You need to install the "new" nested ifs MOD found in the resource center.

2. if that doesn't work, post that part of the code from you site_templates_html.pl so we can examine it.

Good Luck
Aaron

------------------
www.serve.com/garden/geosearcher



Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Installed the mod you mentioned made no difference at all.

Here is the code added to the site template html.
########################################################################################
# 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);
my ($half) = int (($#subcat+3) / 3);

# Print Header.
$output = qq|<div align="center"><table border="0" cellspacing="0" cellpadding="12" width=""><tr><td valign="top" width="">\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"}[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 valign="top" width="">\n|;
$i = 0;
} $i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<font face="Verdana, Helevtica, Arial" size=3><b><a href="$url">$category_name</a></b></font>|;
my $days_old = &days_old($mod);
if ($days_old <= 2) { $output .= qq| $new_1|; }
elsif ($days_old <= 7) { $output .= qq| $new_3|; }
elsif ($days_old <= 14) { $output .= qq| $new_7|; }
$output .= qq|<br><font face="Verdana, Helevtica, Arial" size=1>(There are $numlinks links in this category)</font><BR>|;
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~$form_font $form_start <option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~ $form_end ~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
elsif ($description =~ /^SUB.*/) {
$output .= qq~$form_font $form_start <option value="">--Select a Subcategory--~ if ($description =~ /3$/);
$output .= qq~<option value="">None $form_end~ if ($description =~ /3$/);
}
else {
$output .= qq~<dd>$form_font $description</font>~ if (!($description =~ /^[\s\n]*$/));
}
}
# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
}


------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory

Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
if I want sub-cats. are to be displayed in NonEnglish way, but retain all links in English format, How to?
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
uh.. looks like he doesn't have my

foreach $subcatsub thingy.. Smile

jerry
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Hi Jerry !!

Yes it is there !

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







------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory

Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
i said subcatsub..

the first one finds the category names.. the second one finds the subcategory names..

he didn't put the second one in Smile

jerry
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
 Smile

My apologises - I stick to what I am good at Smile Following instructions and cutting and pasting - hehehe.

I guess I have to wait for Aaoron to answer to see why it wont work on the snap templates.


------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory

Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
yyho..

you want the categories to display in nonenglish right?

find this:

Code:
foreach $subcatsub (sort @{$subcategories{$subcat}}) {

make sure you found the right thing!! cause there is another above it that says foreach $subcat instead..

then put this right below it..

Code:
($nonenglish) = @{$category{$subcatsub}}[8];
$subcatsub = $nonenglish if ($nonenglish);

ok.. hope that helps

jerry
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Hi Jerry,

First of all, thanks for your help, but..

Yes, the display is changed to Nonenglish, but URL changed too!!! that's the problem I asked b4, and it still there...

How could I amend this script to Nonenglish display with English URL?

Here's my URL
http://search.website.com.hk

Please help, Thank you!
Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
Sorry, I forgot to tell what my Variable were... I fixed the post above, so it should work now.

------------------
www.serve.com/garden/geosearcher



Quote Reply
Re: SUBCATEGORIES FOR LINKS MOD In reply to
my bad....

add:

Code:
($nonenglish) = @{$category{$subcatsub}}[8];
$subcatsub = $nonenglish if ($nonenglish);

after:

Code:
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";

so it looks like

Code:
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
($nonenglish) = @{$category{$subcatsub}}[8];
$subcatsub = $nonenglish if ($nonenglish);

please reply if this works so i can post it on my site

jerry
> >