Gossamer Forum
Home : Products : Links 2.0 : Customization :

SUBCATEGORIES LIKE YAHOO v2.1

(Page 2 of 6)
> > > >
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
could you tell me what is this now?$output .= qq~    ~ if ($style eq "1");
thank you for your help, because now I have nph-build.cgi problems, it try to download instead of running
I have nph-build.cgi downloading as
Error including libraries: Unmatched right bracket at /web/space/d01/sec/s35/U00001fa/cgi-bin/link/admin/site_html_templates.pl line 453, at end of line
syntax error at /web/space/d01/sec/s35/U00001fa/cgi-bin/link/admin/site_html_templates.pl line 453, near "}"

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


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


[This message has been edited by phandsome (edited February 21, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
<sigh> Yes, it *does* work on a vanilla installation. Unfortunately, I have added several mods which asre necessary here, especially the one for AltCategories, which I suspect may be why this mod fails to provide *any* category name output in my primary installation. Time to print out some code and see if I can figure it out.

On the other hand, it might be simpler just to use the suggestions above of manually putting the links in the description field, and letting it go at that (we only have about 15-20 categories with subcategories).

Good luck to you all. Smile

-Spode
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
my code is http://steelshare.netfirms.com/site_html_templates.txt,

I have subcat field during my admin window, but when I build all or auto stagger, it try to download nph-build.cgi.
thank you for your help

------------------
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Calling All gods!

How does one specify a category AS a subcategory? In other words, how do I get past the simple fact that:

> (Note: The script will display SUB1 or SUB2 as the category description when you do not have any subcategories in that category!)

The mod appears to be running fine on my site. And yet I do not know how to create subcategories. I am assuming that the automation this mod offers includes creating not only the mention of subcategories, but also the pages/etc which are required.

Might anyone shed some light on this darkened soul?

Thanx
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
To create sub-categories (as mentioned in the README file and also in many Threads in the Discussion Forum and this forum)...You use the following syntax in the Category field:

Code:
My_Category/Sub_Category_1

OR

Code:
MYCategory/SubCategory1

The Mod in this Thread is for automatically PRINTING sub-categories in the Home Page underneath the main categories.

Regards.

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
AnthroRules

Thanks for your prompt reply. With your aid I have now found the missing piece of the puzzle and am happy to report that both the links2 script and the the subcategories mod are working well.

Much appreciation.

www.TheologyWebsite.com
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Great Mod...Finally got a chance to install it.

I would recommend submitting this Mod to the Resource Center if you have not done so yet.

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
BTW: You might want to change the following codes:

Code:
$output .= qq|<a class="catlist" href="$url">$description</a> <font class="catlist">($numlinks)</font> |;

with the following codes:

Code:
$output .= qq|<a class="catlist" href="$url">$category_name</a> <font class="catlist">($numlinks)</font> |;

Also, Kracken, I have reviewed your codes and for the life of me, I cannot figure out why one of my Categories on the main home page of my site does NOT print the subcategories. I have specified the SubCatStyle of this Category to be (ALL)1.

Go here to see what I am talking about:


And the Category I am referring to is Education.

Any thoughts?

Regards,


------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Forget it...I was missing a delimiter for the Education category when I edited the file via my text editor.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Eliot,

I had not thought about you code suggestion that way. I will make the change with a note about displaying descriptions rather than category names.

Chow,

------------------
===========================
Bert Gaddis
Sysop, The-BBS.COM

http://www.the-bbs.com
===========================
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Eliot,

Adding that line of code you suggested would defeat what I was trying to do. I intended to display the category description instead of the category name.
Say I have a category named Home & Family, I enter the cat catagory name as Home_Family, and the description as Home & Family. It would display Home & Family instead of Home Family.

Regards


------------------
===========================
Bert Gaddis
Sysop, The-BBS.COM

http://www.the-bbs.com
===========================
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Kracken,

Well, to make it useful for other users who are not trying to do what you are doing exactly, using $category_name is more appropriate than $description. Because when I installed your MOD, NONE of the main categories displayed until I replaced the $description variable with $category_name. Thank godness I know my way around LINKS and Perl...But if this is a true Mod, it needs to be easily adapted by users have less skill sets and knowledge than you.

I was providing you a helpful suggestion. But since you decided to leave it, I will be leary about answering any of your technical questions in the future. I was trying to be helpful!

GOOD DAY!

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Holy Shit!!!!!

I am so confused I don't know what to do!

I have 2 different ways to add Yahoo subcatagories. I have tried both but have found myself lost in these fragmented threads.

Can one person create one thread that explains the one way to add these subcatagories?

I just downloaded the latest links and also downloaded the latest Yahoo template!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Mick
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
All the codes you need are in Kracken's first post, which he/she has edited.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
This MOD works great for me EXCEPT that I want
the $nonenglish value to display instead of
the $category_name

$nonenglish is part of the Non-enlgish MOD
which is the only other MOD I am running on
this version.

I have tried lots of alterations and just cannot
get it to display correctly. Can anyone help?

Thanks.

-Spode
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
How about posting the alterations you've tried, and we may be able to help you?

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums


[This message has been edited by AnthroRules (edited March 14, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I believe I've made the proper changes to all forementioned files (even waded through the appendages in this thread)but.....

Right from the start as soon as I made these changes my categories diappeared! DOH! Even
when I add new categories they do not appear.
My subcategories seem to be working ok for now. The one peculiar thing which may help
you guys to debug this is that my first main category was replaced by the subcategories in it. That is the only one that shows up...

hmmmm... any ideas (seen this before?)

Thanx
Craig
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
>How about posting the alterations you've
>tried, and we may be able to help you?

Ok - Sorry for not including some of this earlier:

I won't list all the details fo the non-english MOD from the Links resource center,
except to summarize that it involves adding an alpha field to category.def,
inputting the non-english (Chinese in our case) category name there, and having
that field used for the name display, with the regular $category_name used for
the URL. The line in my category.def is
Nonenglish => [8, 'alpha', 40, 75, 0, '', ''],

For the Yahoo v2.1 MOD, I changed the default field 8 to be field 9:
SubCatStyle => [9, 'alpha', 40, 100, 0, '(ALL)1', '']

In site_html_templates.pl, sub site_html_print_cat is where I am struggling.
I will include the complete subroutine below as I have it now. Basically, I
need to figure out how to have this line:
$output .= qq~<a class="subcat" href="$url">$category_name</a>~;
modified to display the $nonenglish value instead of the $category_name value.
I tried $output .= qq~<a class="subcat" href="$url">$nonenglish</a>~; but that just
gave me "ALL" for each category, so the subroutine seems to be defaulting to the
$description value.


In foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
($subcatstyle eq "ALL" && $#subcatsub == 0) ?
($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
#($_ =~ m,.*/([^/]+)$, and $category_name = &build_last_title_mb($nonenglish)) :
#($_ =~ m,.*/([^/]+)$, and $category_name = &kategorie_title_mb($nonenglish)) :
($_ eq "$subcat/$category_name" or next);

I tried each of those commented changes, but the result was confusing. At first,
I thought that $category_name was already set to the value of $nonenglish, due to
the earlier if statement:

if ($nonenglish eq "") {
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
}
else {
$category_name = &build_last_title_mb($nonenglish);
}

But then why would the last line of the above foreach statement give the correct URL
(which it does)?

Anyway - here is the entire site_html_print_cat subroutine from my site_html_templates.pl
file. I just don't have enough knowledge to figure this out - or perhaps I should have
taken that login course in University. Smile

-Spode

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) = @_;
# ***************************************** nonenglish modification - begin ****************
# my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i, $nonenglish);
# ***************************************** nonenglish modification - end ******************
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];
# ***************************************** nonenglish modification - begin ****************
($nonenglish) = @{$category{$subcat}}[8];
# ***************************************** nonenglish modification - end ******************
# ***************************************** yahoo 2.1 modification - begin ****************
($subcatstyle) = @{$category{$subcat}}[9];
# ***************************************** yahoo 2.1 modification - end ******************

# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
# ***************************************** nonenglish modification - begin ****************
# if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
if ($nonenglish eq "") {
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
}
else {
$category_name = &build_last_title_mb($nonenglish);
}
# ***************************************** nonenglish modification - end ******************
$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++;

# ***************************************** yahoo 2.1 modification - begin ****************
# 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;
#}
# 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~<DD>~ if ($style eq "1");
foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
($subcatstyle eq "ALL" && $#subcatsub == 0) ?
($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
#($_ =~ m,.*/([^/]+)$, and $category_name = &build_last_title_mb($nonenglish)) :
#($_ =~ m,.*/([^/]+)$, and $category_name = &kategorie_title_mb($nonenglish)) :

($_ eq "$subcat/$category_name" or next);
if ($style eq "1") {
$length += length($nonenglish);
($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>~;
#$output .= qq~<a class="subcat" href="$url">$nonenglish</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;
}
# ***************************************** yahoo 2.1 modification - end ****************

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Aargh. That should have said 'logic', not 'login':
perhaps I should have taken that logic course in University.
Sorry.

-Spode
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I've got the same problem...and I just got the same code .....

but no category at all is printed...perhaps someone can help

...but you forgot to ...print the end of the code....
after...
$output .= "</td></tr></table></div>\n";
return $output;
}


comes this


# ***************************************** nonenglish modification - begin ****************
sub kategorie_title_mb {
# --------------------------------------------------------
open (DB, "<$db_category_name") or &cgierr("unable to open $db_file_name. Reason: $!");
@kategorien = <DB>;
close DB;

my ($input, $output, $title, $kategorie, @fields);

$input = $_[0];
$title = "";

KATEGORIE: foreach $kategorie (@kategorien) {
if ($kategorie =~ /^#/) { next KATEGORIE; } # Skip comment lines.
chomp ($kategorie);
@fields = &split_decode ($kategorie);
if (@fields[1] eq $input) {
$title = @fields[8];
$title =~ s,\\, : ,g;
last KATEGORIE;
}
}
if ($title eq "") {
$output = &build_clean ($input);
}
else {
$output = $title;
}

return $output;
}
# ***************************************** nonenglish modification - end ******************

thank....I know you'll help me

[This message has been edited by pflaume (edited March 18, 2000).]

[This message has been edited by pflaume (edited March 18, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Can someone look at my yahoo template at www.todayslearning.com and tell me what im doing wrong. If you need permission to get in let me know.

Marc Parish
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
[mp]

Your problem is NOT related to the Yahoo! template. You need to properly reference the links.css file in your template files.

I receive the following Error when I access your site:

Quote:
Not Found

The requested URL /links.css was not found on this server.

Use the correct relative path to your links.css file in your template files.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hi,

I am having a problem with the nph-build.cgi, when I inserted the new code in category.def, site_html_templates.pl and links.cfg, uploaded the file and pressed on build all in my Administration Menu, I try to download nph-build.cgi...

Thanx

theuls


------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
OK, I read a bit downer, and I change some lines in site-template-html and I can built, but no categorie appear, only the number of links in them!!!

THANX

THEULS
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hello all, just a couple questions and perhaps a fix for theuls.

1. Is it possible for the subcategories to show up along with text descriptions? Ie. Category1 - Description : Subcat1, Subcat2, Subcat3... ?

2. Also i'm having indentation problems. Instead of building it like so:
Code:
Category1 (65) Category3 (23)
subcat1, subcat2 subcat1
Category2 (34) Category4 (12)
subcat1, subcat2, subcat3... subcat1
Instead it will just build it like this:
Code:
Category1 (65) Category3(23)
subcat1, subcat2 subcat1
Category2 (34) Category4 (12)
subcat1, subcat2, subcat3... subcat1
any suggestions?

Thanks.

Oh theuls...I had that number of links thing problem before.....it was like: when you build the program just gives a listing of number of links like:
(32) (52)
(24) (3)

instead of:
Category1 (32) Category2 (52)
Category3 (24) Category4 (3)

Right? Well that happened to me because i was following the ORIGINAL *.txt instructions and not the updated one in this thread. This is how i fixed mine...

Find this sub in site_html_templates.pl
Code:
sub site_html_category {

Delete this line above the %globals entry
Code:
subcatstyle => $subcatstyle,

It started to work for me then...but then stupid indentation didn't work...

Cheers.
Spacedogg.



[This message has been edited by spacedogg (edited April 16, 2000).]
> > > >