Gossamer Forum
Home : Products : Links 2.0 : Customization :

SUBCATEGORIES LIKE YAHOO v2.1

Quote Reply
SUBCATEGORIES LIKE YAHOO v2.1
A Mod to the Yahoo Style SubCategory Listings Mod by Widgetz.

I wanted to use the Yahoo style Sub-Category listings on my site, but I also wanted to keep the
ability to use the category descriptions. So I came up with this mod to Widgetz Mod to allow
just that.

Notes:
1. Remember to backup files to be edited before proceeding.
2.This Mod assumes no previous mods are installed and you are using templates.
3.If you have an existing categories.db file, you should review information
on Bobsie's upgrade script at
www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/001090.html .
This will help you add the new field spacing to your categories.db.

links/cgi-bin/admin/category.def

Find this section: (it's at the top)

Code:
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', '']
);

Palace this line under the last entry in the list just before the );
Code:
SubCatStyle => [8, 'alpha' ,40, 100, 0, '(ALL)1', '']
^ ^
Filed ID Default Entry

The field id, in this case 8 should be changed to reflect the fields sequence in your database.
Don't forget to place a comma at the end of the entry on the line above SubCatStyle. You can indicate
a default style by placing one of the styles from the bottom of this post in the Default Entry section
of the field definition.

links/cgi-bin/admin/site_html_templates.pl

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

Place this just below it
Code:
($subcatstyle) = @{$category{$subcat}}[8];

Change the filed ID to match the one you entered in the category.def

Find this comment line:
Code:
# Then we print out the name linked, new if it's new, and popular if its popular.

Replace with:
Code:
# 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;
}

If you wish the catagory despcription to be displayed rather than the catagory name replace

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

with

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

links/cgi-bin/admin/links.cfg

Find this section (it's close to the bottom)
Code:
# Site Title, the default title to use. You should really spend some time customizing
# the directory though!
$build_site_title = 'Gossamer Threads';

Insert this bellow it
Code:
# Subcategory Length, the maximum length of the subcategories added into Links.
$subcat_length = '30';

That's it for the CGI Work. Now you need to add the place holder for the new field to your
category database (links/cgi-bin/admin/data/categories.db).
To do this just add a | (see note 3 above) to the end of each record in your database.

To use this mod indicate what style of subcategory listing you would like by entering one of the
styles below in the SubCatStyle filed in the Modify Category screen of the Links Admin page.

Code:
Style Types...

Horizontal Layout (alphabetical.. up to subcat_length)
(ALL)1
Category (#)
Subcategory1, Subcategory2, Subcategory3...


Vertical Layout (alphabetical)
(ALL)2
Category (#)
* Subcategory1
* Subcategory2
* Subcategory3
* Subcategory4


Horizontal Layout (ordered by you)
(Games|Utilities|Hacks)1
Category (#)
Games, Utilities, Hacks


Vertical Layout (ordered by you)
(Games|Utilites|Hacks)2
Category (#)
* Games
* Utilities
* Hacks

That should do it. If you have problems I will do my best to help you. Just post them to this
thread and I will respond as quickly as possible.


----------------------
Bert Gaddis
SysOp, The-BBS.COM
www.the-bbs.com
----------------------


[This message has been edited by Kraken (edited February 29, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hey..

I have followed every instruction just like you put it. However all I get on my site is the categories listed like normal, no subcategories appear. I edited the site_html.pl file
and also the
site_html_templates.pl and the
category.def and the
links.cfg and last but not least the category.db file. I do have a new entry listed in my modify for categories, but the listing obviously doesn't work because it won't list the file.
HELP!!!!?!?!? :- )
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
DanS,

Lets check a few things here. make sure you haved placed $subcat_length = '30'; in your links.cfg file and that your are putting one of the subcat styles in the SubCategoryStyle field in the category modify form. If you have defined a default style in the category.def this only effects new categories you create, not existing categories.

As a test, enter (All)1 in the SubCategoryStyle field for your first category sith subs. Then "Build All". If you made the code changes correctly you should see your caegories listed like Yahoo!



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

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

Ok. I now have the subcategories showing, which is GREAT. Thanks.. BUT..
my site, (http://www.creativesystem.com/slway/)
now has each next category in the list INDENTED
What did I do wrong?? lol
Here is the code that I put into my site_html_templates.pl
-----------------------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>|;
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>~;
$output .= qq|</dl>|;
}}

# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
------------------END-----------
I listed the code before what I pasted and after so that you would know in what section I pasted it :- )


Thanks,
Daniel S.

[This message has been edited by DanS (edited February 12, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Dan,

My bad, I modifyed some additional code. Here is the whole code segmant starting from the #comment line from.

Code:
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<a class="catlist" href="$url">$description</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;
}

I took out the Definition list and forgot to show that in my code.

Sorry

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

http://www.the-bbs.com
===========================
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Now I am back to no subcategories, but the indents are fixed.. .grrrrr :- )
Here's my code:
-----------BEGIN------------
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<a class="catlist" href="$url">$description</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;
}

1;
-----------------END--------------



Ideas??
Daniel S.

[This message has been edited by DanS (edited February 12, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Dan,

Lets have a look at your home.html template. If you could email (bgaddis@the-bbs.com) it to me I'll look it over.




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

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

I have replaced my site_html_templates.pl with yours and all works just fine. I retraced everything I could tink of that could be differant from my syste to yours and the only thing I can come up with is the field ID in the category.def file.

Check to make sure that the field ID in both the site_html_templates.pl and category.def match.

Code segment from site_html_templates.pl
Code:
foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
($subcatstyle) = @{$category{$subcat}}[8];
^
Field ID

Code segment from category.def
Code:
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', ''],
SubCatStyle => [8, 'alpha', 40, 100, 0, '(ALL)1', '']
);
^
Field ID

Regards



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

www.the-bbs.com
===========================

[This message has been edited by Kraken (edited February 12, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Dan,

I see you have it working at http://www.creativesystem.com/slway . was the problem the field ID?



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

http://www.the-bbs.com
===========================
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Kraken,
No I got tired of fooling with it after using many hours and not getting anywhere so I just used the old code from the MODS area..
I would have liked to use yours but I just couldn't get it to work.. :- )

Daniel S.
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
The problem might be that the following in links.cfg might have been added twice
Code:
# Subcategory Length, the maximum length of the subcategories added into Links.$subcat_length = '30';

If you already use widgetz' yahoo2 mod, you already have this in. It might not need to be added, as in the directions above.

HTH
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Kraken's 'Subcategories like Yahoo' is the first mod that I have installed for links so far. So it wouldn't be widgetz' yahoo mod. I had looked at that but hadn't installed it.. I have made my own template for the way my site looks.

Daniel S.

[This message has been edited by DanS (edited February 13, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I've just noticed a couple of odd things in your code nad have a question.

This code appears to be incorrect because you are making a link to the description:

Code:
. $output .= qq|<a class="catlist" href="$url">$description</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>|;

My question is that only two subcategories are showing up. Any idea why that would happen?
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
The reason that the link is to the description (correct me if I am wrong) is that field is where the sub-categories are stored.

To increase the number of sub-categories listed, you need to increase the value of the following variable:

Code:
$subcat_length = '30';

Like the following:

Code:
$subcat_length = '60';

This variable is the trigger variable that specifies the total length for sub-categories. So, if you want more sub-categories...increase the value.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
The description, in this case, IS the Category Name.

In admin, in your category description box, type in what you want the category name to say. Then, build.

The "description" shows up as a linked category name on your page.

[This message has been edited by DogTags (edited February 15, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Blue

On my site I wanted to provide more detailed explanations of the categories, but did not want to display both the category name and the description.

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

Nice Mod...One thing that I would add to your instructions is that if people have an existing categories.db file, they will need to add the new field spacing in their categories.db file using Bobsie's upgrade.pl file.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









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

Coming from you that means alot, but the bulk of the work was done
by Widgetz. I took your suggestion and added a link to Bobsie's
upgrade script.

Chow,



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

http://www.the-bbs.com
===========================
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Good...it will help novice users.

If more people have success with this modification...you should add it to the Resource Center (yet crediting Widgetz and Bobsie for their contributions).

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Please help. I set up the Yahoo mod 2.1 on my site but now the categories dont appear on the built pages.

The admin page is here

http://www.students.f2s.com/cgi-bin/links/admin/admin.cgi

Username and pass: 12345

Thanks for your help.
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Rambo2,

I tryed to view your site but the username and password you provided didn't work.

Any how I think I know what the problem my be, if you specifyed a default SubCat Style in the record definition section of links.def this does not apply to currently existing records. You need to define a SubCat style such as (ALL)1, manualy for each existing Category and do not define any style for the SubCategory.



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

http://www.the-bbs.com
===========================
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hi me again. I fixed the problem. Sorry about before. Anyway the categories are showing up because I put the name in the description but the subcategories wont show up. Please help me.

The url to the admin script is:
http://www.students.f2s.com/cgi-bin/links/admin/admin.cgi

And the pages are at :

http://www.students.f2s.com/pages/

Thanks
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
sorry, could you help me and check my problems, my site is upgraded from english to chinese, but it doest not work till I change all the data as mentioned in your intro,
by the way, my admin page works well, and I have the subcatstyle field, and building all is correct, but my subcat does not show up

[This message has been edited by phandsome (edited February 20, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Rambo2, phandsome,

Thinking I left something out of my instructions I built a new site
with a clean version of Links to test my mod.

I followed my own directions to the letter, and what do you know it
worked just as it should.

The only thing I can come up with that you may be missing is adding
the SubCatStyle field place holder into your categories.db file. If
you miss this step the sub-categories will not build, nor will links
generate an error.

I suggest that you read through the direction again and make the
correction to your categories.db file.

Regards


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

http://www.the-bbs.com
===========================
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
my problem is how can I add:
code:
--------------------------------------------------------------------------------

Style Types...Horizontal Layout (alphabetical.. up to subcat_length)(ALL)1 Category (#) Subcategory1, Subcategory2, Subcategory3...Vertical Layout (alphabetical)(ALL)2 Category (#) * Subcategory1 * Subcategory2 * Subcategory3 * Subcategory4Horizontal Layout (ordered by you)(Games|Utilities|Hacks)1 Category (#) Games, Utilities, HacksVertical Layout (ordered by you)(Games|Utilites|Hacks)2 Category (#) * Games * Utilities * Hacks

I have the SubCat Field


[This message has been edited by phandsome (edited February 21, 2000).]
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).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
thanx for trying to help me spacedogg,but I tried what you suggested, and it didn't work...
Do you or Someone else please help me???

THEULS

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
could somebody please help me?????


theuls

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I am also having problems with the build all .cgi. It brings up a download window. What changes do I need to make to fix this...
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I am having the same problems as Theuls. When I try to build all it tries to run or download the build.cgi but nothing happens until the connection times out.

Help is appreciated.
Thanks
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
If you have access to your server logs you can look at them and see what the error is while trying to build.

The reason it is asking you to download is because there is an error somewhere.

Also do like I did, I replaced the nph_build.cgi with the original then when I built the site everything seemed to work. Then go back and make changes one at a time.

Larry

[This message has been edited by NewToThis (edited April 17, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Please help, I'm really desperate...


THEULS

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I just understood what my problem was, I just had forgotten a line...
But now I'm having the same problems as drmaster: I try to download
Nph-build every time I press on build all or staggered!!!

PLEASE HELP,

THEULS

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
NewToThis,

I tried what U suggested, but it didn't work...


THEULS

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
HINT: If you save the nph-build.cgi file when it asks you to download...you will see error messages in the downloaded file.

Did you download the file?

If not...download it and you will see the errors.

It most likely is related to syntax errors in the site_html_templates.pl file.

Also, check the syntax of the site_html_templates.pl through telnet or your Perl Error Logs.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* 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
AnthroRules,

here is what it say:
Error including libraries: Unmatched right bracket at /home/surfootb/cgi-
bin/links/admin/site_html_templates.pl line 450, at end of line
syntax error at /home/surfootb/cgi-bin/links/admin/site_html_templates.pl
line 450, near "}"

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

you can see my site_html_templates.pl as a txt @ http://surfootball ovh.org/site_html_templates.txt

Please help,


THEULS


------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Theuls,

Find this,
$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>|;
}

Try taking out the last } after$output .= qq|</dl>|;
see if that works

Larry

[This message has been edited by NewToThis (edited April 18, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Newtothis,

still didn't work... No more ideas???


THEULS
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
BUT NOW IT SAYS/
Error including libraries: Unmatched right bracket at /home/surfootb/cgi-bin/links/admin/site_html_templates.pl line 498, at end of line
syntax error at /home/surfootb/cgi-bin/links/admin/site_html_templates.pl line 498, near "}"

Make sure they exist, permissions are set properly, and paths are set correctly.
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Paste the last 10 lines of your code here for me to see. Again only the last 10 lines...

Larry

[This message has been edited by NewToThis (edited April 18, 2000).]
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Where is this code from?


$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;
}


Try removing it and see what happens.

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

the lines you suggested to take away are used by nph-build for the categories
layout... Anyhow, I tried to "buid all", and it worked... Now the problem is that
the categories don't show up and neither does the subcategories...
That's why I think the problem comes from that area....
Since I'm not very good in perl, I don't know what to do...


THEULS


------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Newtothis

He it is,
code:

$output .= "</td></tr></table></div>\n";
return $output;
}

$output .= qq|<dl><dt><font face="Arial" size="2"><strong><a href="$url">$category_name</a></font></strong> <font face="Arial" size="1"><i>($numlinks)</i></font> |;
$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;
}

1;

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Please Help!!!!


THEULS

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Theuls,

Replace your site_html_template.cgi with the original one. Build your directory. If it works. Make changes 1 at a time until you have it the way you need. I can not find the code you are using anywhere in the site_html_template.cgi that I have set up.

Larry
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
What I suggest is that you give me your 500 last lines of your site-html-templates.cgi, and I put it on mine...


THEULS

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
That would do you no good.
I have made alot of changes to my files in regards to the way it sorts and displays things. Would not work for you.

Larry
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
 grrrrrrrrrrrrrr!!!!
Wink
So, is there a way that I could get this working????????
Well, maybe I should do without!!!!!!! By the way NewToThis,
are U using exactely the code above???? What is your webpage adress???


THEULS

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Theuls,

My code does not look like the code above. I do not have the site live on the net yet. Doing a lot of testing before I go live with the site. I could set up a a little demo of what I am trying to do with it later this week maybe.

Also tell me what mods you have added to your script.
Do you back up your originals before making changes? Wink

I was having a similar problem like your before. Started with the originals again. Read the forums and added mods one at a time. Found a few short cuts along the way too.

This is one of the ways to learn to hack code good is trial an error.

Let me know what changes you have made to the original scripts and I will see where I can help

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

I installed some mods, and now, almost nothing is working...
Thats why I think I'mgonna reinstall every thing all over again Frown
I'll send a reply in 3 or 4 hour to tell you what I did...

See you,

THEULS

------------------
Surfootball.ovh.org
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I couldn't make it work, so I stopped trying... And I installed the old
version of the Mod... But THANX A LOT NewTo This for trying to help me:
Smile Wink

THEULS

------------------
----------------------
Surfootball.ovh.org
----------------------
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I still can't get mine to work either. It gives me this error when I try to build:

Error including libraries: Unmatched right bracket at D:/216.247.220.101/cgi-bin/links/admin/site_html_templates.pl line 452, at end of line syntax error at D:/216.247.220.101/cgi-bin/links/admin/site_html_templates.pl line 452, near "}" Make sure they exist, permissions are set properly, and paths are set correctly.

I've gone through every remedy in this thread and I can't get anything to work either. I've also tried the whole process several times without any luck.

Let me know if anyone has any new ideas or would like to see my code.

Thanks
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Tell me what other mods you have added and put your files somewhere on your server so I can see them from the browser.

Larry
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I've made no other mods to my links. The only thing I've really done is alter the templates but I re-installed the default ones and got the same results.

Here are my files on my server:

categories.def > http://www.CompleteCrafts.com/links/categories.txt
site_html_templates.pl > http://www.CompleteCrafts.com/links/site_html_templates.txt
links.cfg > http://www.CompleteCrafts.com/links/links.txt

Let me know if you need to see anything else or have any other questions.

Thanks again for your help.


Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Sorry about that.

categories.def should be category.def and the correct link to my file on the sever is http://CompleteCrafts.com/links/category.txt

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Can someone please try to help me out and take a look at my code above to see what problems I'm having.

Thanks in advance.
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
erac,

The problem does not seem to lie with the files you gave...you must've forgotten to put the appopriate codes in the nph-build.cgi script. Re-read the instructions and put the correct codes in the nph-build.cgi file.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* 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
What am I missing now? I've re-read the instructions and don't see anything about altering nph-build.cgi. This seems way to easy for me to be having this much trouble.

Should I maybe just try to install one of the other yahoo subcat mods? I've seen where there are a few different ones but I'm not sure what the differences are. I don't want to give up on this one though if I'm close.

Thanks again for your help.
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
My fault...I apologize for the confusion...I had to do something different based on the different number of fields in my category.def file, so I had to edit my nph-build.cgi file.

Some people have found widgetz's subcategories mod easy to install...there is another Topic called Subcategories like Yahoo...and it has been brought to the top of the forum, so it should not be hard to find.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* 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 All,

I recently added the Yahoo v2.1 mod and can't seem to get some categorys or sub-categorys to display on the main page. Also installed are the 3 level of New Graphics, and the Password Modify For Templates. I've gone over the mod docs and checked everything twice and can't seem to find the problem. I have a category named Construction with a sub named Construction/General, both of these show up on the main page. I have a Internet category with 2 subs named Internet/Hosting and Internet/Website_Design, and a cat named Restaurants with a sub named Restaurants/Seafood. Neither the Internet or Restaurants or their subs display on the main page. I even add links in them, still nothing. My site's URL is

www.maine-business.com/links

Here's the relevant sections of code:

category.def:
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', ''],
SubCatStyle => [8, 'alpha', 40, 100, 0, '(ALL)2', '']
);

site_html_templates.pl:

foreach $subcat (sort @subcat) {
my $mod = $stats{"$subcat"}[3];
my $new_add = $stats{"$subcat"}[4];
($description) = @{$category{$subcat}}[2];
($subcatstyle) = @{$category{$subcat}}[8];



sub site_html_category {
# --------------------------------------------------------
# This rountine will build a page based for the current category.

return &load_template ( 'category.html', {
date => $date,
time => $time,
category => $category,
links => $links,
title_linked => $title_linked,
title => $title,
total => $total,
grand_total => $grand_total,
category_name => $category_name,
category_name_escaped => $category_name_escaped,
category_clean => $category_clean,
description => $description,
meta_name => $meta_name,
meta_keywords => $meta_keywords,
header => $header,
footer => $footer,
prev => $prev,
next => $next,
related => $related,
build_links_per_page => $build_links_per_page,
subcatstyle => $subcatstyle,
%globals
} );
}



# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<a class="catlist" href="$url">$description</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;

$output .= qq|<dl><dt><strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
if ($new_add eq "Yes") {
$days_old = &days_old($stats{"$subcat"}[2]);
if ($days_old <= 2) { $output .= qq| $new_1|; }
elsif ($days_old <= 7) { $output .= qq| $new_3|; }
elsif ($days_old <= 14) { $output .= qq| $new_7|; }
}
if ($mod eq "Yes") { $output .= qq~ $updated~; }

$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;
}

1;


I think that's everything. Please help me out!

Thanks!

Mike
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Someone Please help!
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
hi...

please do one of the following..

1) delete this mod
2) delete original code from SubLikeYahoo2 and make your own

cya

Jerry Su
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Try this mod MOD: (Mine)

SUBCATEGORIES LIKE YAHOO v2.1(Modified)
A Mod to the Yahoo Style SubCategory Listings Mod by Widgetz.

THIS MOD MUST BE USED ONLY IN site_html.pl (NO TEMPLATES).

Modified for no templates by
Eduin Yesid Carrillo yecarrillo@hotmail.com (aug 9 /2000)

I wanted to use the Yahoo style Sub-Category listings on my site, but I also wanted to
keep the ability to us category descriptions. So I came up with this mod to Widgetz
Mod to allow just that.

Notes: Remember to backup files to be edited before proceeding. This Mod assumes
no previous mods are installed and you are using templates.
Notes:
1. Remember to backup files to be edited before proceeding.
2. This Mod assumes no previous mods are installed and you are using templates.
3. If you have an existing categories.db file, you should review the information
in Bobsie's upgrade script at http://www.gossamer-threads.com/...um3/HTML/001090.html
With some work it will help you add the new field spacing to your categories.db.

links/cgi-bin/admin/category.def

Find this section: (it's at the top)

# Definition of your database file.
Code:
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', '']
);
Palace this line under the last entry in the list just before the );
Code:
SubCatStyle => [8, 'alpha' ,40, 100, 0, '(ALL)1', '']
^ ^
Filed ID Default Entry
The field id, in this case 8 should be changed to reflect the fields sequence in your database.
Don't forget to place a comma at the end of the entry on the line above SubCatStyle. You can
indicate a default style by placing one of the styles from the bottom of this post in the Default
Entry section of the field definition.

links/cgi-bin/admin/site_html.pl

Find this:
Code:
foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
Place this just below it
Code:
($subcatstyle) = @{$category{$subcat}}[8];
Change the filed ID to match the one you entered in the category.def

Find this sub
Code:
sub site_html_category {
Insert this below the my ($output); entry
Code:
$subcatstyle = $category{$category_name}[8];
Change the filed ID to match the one you entered in the category.def

Find this text:
Code:
# 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>~;
Replace with:
Code:
# 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>~;

$maxitems = 3;
if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {
($subcatstyle, $estilo) = ($1, $2);
$s = 0;
@subcatsub = split (/\|/, $subcatstyle);
$output .= qq~ <small>~;
$output .= qq~
~ if ($estilo 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 ($estilo eq "3") {
$length += length($category_name);
($length > $subcat_length) and last;
}
if ($s > 0) {
$output .= qq~, ~ and $length += 2 if ($estilo eq "1");
$output .= qq~ ~ if ($estilo eq "2");
}
$url = "$build_root_url/" . &urlencode($_) . "/";
$output .= qq~<LI>~ if ($estilo eq "2");
$category_name =~ s/_/ /g;
$output .= qq~<a class="subcat" href="$url">$category_name</a>~;
$s++;
# last if ($subcatstyle ne "ALL" && $#subcatsub > 0);
last if (($subcatstyle ne "ALL" && $#subcatsub > 0)||($s>$maxitems - 1));
}
}
undef $length;
# if ($s < $#{$subcategories{$subcat}}) {
if ($s >= $maxitems) {
$output .= qq~ ...~ if ($estilo eq "1");
$output .= qq~<li> ...~ if ($estilo eq "2");
}
$output .= qq~</small><BR>~;
}
else {
}
Change the $maxitems value to match the number of subcats
that you want to show for each category.

That's it for the CGI Work. No you need to add the place holder for the new field to your category
database (links/cgi-bin/admin/data/categories.db). To do this just add a | (see note 3 above)
to the end of each record in your database.

To use this mod indicate what style of subcategory listing you would like by entering one of the
styles below in the SubCatStyle filed in the Modify Category screen of the Links Admin page.

Code:
Style Types...

Horizontal Layout (alphabetical.. up to subcat_length)
(ALL)1
Category (#)
Subcategory1, Subcategory2, Subcategory3...

Vertical Layout (alphabetical)
(ALL)2
Category (#)
* Subcategory1
* Subcategory2
* Subcategory3
* Subcategory4

Horizontal Layout (ordered by you)
(Games|Utilities|Hacks)1
Category (#)
Games, Utilities, Hacks

Vertical Layout (ordered by you)
(Games|Utilites|Hacks)2
Category (#)
* Games
* Utilities
* Hacks

That should do it.
If you have problems I will do my best to help you.
Just email me to yecarrillo@hotmail.com
and post to the original mod
thread at http://www.gossamer-threads.com/...um3/HTML/004954.html
and I will respond as quickly as possible.



Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Okay. I've been really struggling with this.

I have tried many different codes. And for reasons that I won't mention here, I believe that the problem lies in the code below. It's kind of bizarre - on the front page it works, and yet on most of the others, it doesn't.

I'd really appreciate someone taking a quick look at the code. Thanks in advance.



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





###################################### YAHOO MOD ##################################
# 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;
}

######################################################




Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I am installing the mod by Widgetz, I have just one question...regarding adding the "b /b" place holder for the new field to your category
database (links/cgi-bin/admin/data/categories.db)

Where exactly does this code go?

My file (/data/categories.db) consits of the following information:

1|Affiliate_Directories||||||
2|Graphic_Design||||||

Any replies, information, help, is greatly appericated!
Thanks,
DKG



Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
It adds a new field, or "column" to your database, so to speak. Delimeters are used to seperate data into columns, and without adding a new delimeter to the end of each line, your database will become corrupted.

--Drew
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Thanks for the reply. :)

I have the mod installed now and it looks great. First MOD I have ever installed.

I do have one other question, maybe you know how to accomplish this?

When you go to /links/pages/ (where home.html displays)
The Catagories display in (FONT SIZE="1") ... fine,
but so do the SubCategories.

Is it possible to somehow control FONT SIZE for SubCategories? Perhaps to be (FONT SIZE="-1") ?

I use templates & links.css.

In template for home.html the code is simply:

<h2>Categories:</h2>

<%category%>

I thought maybe to do this I could add code that would refer to "subcategories" ???

Any ideas?

Thanks again, so much! :)

Regards,
DKG


Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
i've managed to install this hack and it works. But if you chose: Vertical Layout (ordered by you) and there are spaces in your subcategories, it displays the "_".

eg: maincategory: Hello
subcategory: My_Files
subcategory style of Hello: (My_files) displays it as following:
Hello
* My_Files

How can you remove the "_" in the output?


Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I have tried to install this mod to the script however I get the following error:

Error Message : fatal error: syntax error at /admin/category.def line 32, near "^ ^"


Here is my relevant section of the category.def

# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', ''],
SubCatStyle => [8, 'alpha',40, 100, 0, '(ALL 1', '']
^ ^
Filed ID Default Entry
);




Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Code:
SubCatStyle => [8, 'alpha',40, 100, 0, '(ALL 1', '']
^ ^
Filed ID Default Entry
Pretty obvious...don't you see it?

Here's one (in blue):
Code:
SubCatStyle => [8, 'alpha',40, 100, 0, '(ALL 1', '']
^ ^
Filed ID Default Entry
That should be:
Code:
SubCatStyle => [8, 'alpha',40, 100, 0, '(ALL)1', '']
^ ^
Filed ID Default Entry
Here's the other (in blue):
Code:
SubCatStyle => [8, 'alpha',40, 100, 0, '(ALL 1', '']
^ ^
Filed ID Default Entry
That shouldn't be there.

Now the whole %db_def hash should look like:
Code:
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Name => [1, 'alpha', 40, 75, 1, '', '^[\w\d/_-]+$'],
Description => [2, 'alpha', '40x3', 500, 0, '', ''],
Related => [3, 'alpha', 0, 255, 0, '', ''],
'Meta Description' => [4, 'alpha', 40, 75, 0, '', ''],
'Meta Keywords' => [5, 'alpha', 40, 75, 0, '', ''],
Header => [6, 'alpha', 40, 75, 0, '', ''],
Footer => [7, 'alpha', 40, 75, 0, '', ''],
SubCatStyle => [8, 'alpha',40, 100, 0, '(ALL)1', '']
);
--Drew
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Thank You. Sometimes the most obvious mistakes are the hardest to get. How could I be soooo stupid.

Thanks again!

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Okay I am now able to run it with no errors, however my subcategories are not showing up. I can create them and they are saved but they do not show up on my home.html page.

I have red all of the past messages with no help.

I am not sure what code to show you guys.

Is it possible to just install somebody elses code, since I have nothing important in my directory anyways??

Quote Reply
Removing "_" characters from subcatagories In reply to
You can remove the "_" character (well, actually replace it with a space, as removing it entirely probably isn't what you want to do) by doing this:

In the file:
site_html_templates.pl
Find the line:
$output .= qq~<LI>~ if ($style eq "2");
And add the following line after it:
$category_name =~ tr/_/ /;




Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1<br> In reply to
I am using the Nicholas Clark site_html_templates.pl that came with the yahoo57 templates.

I changed all the files for the Yahoo Style SubCategory Listings Mod by Widgetz and now when I am in admin, I get this error when I click on BUILD ALL:


Error including libraries: Unmatched right curly bracket at /virtualhosts/p4k-tv.com/www/cgi-bin/links/admin1/site_html_templates.pl line 508, at end of line
syntax error at /virtualhosts/p4k-tv.com/www/cgi-bin/links/admin1/site_html_templates.pl line 508, near "}"
Compilation failed in require at nph-build.cgi line 33.

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

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

And when I click on VIE catagory I get this error:


Error Message : fatal error: syntax error at /virtualhosts/p4k-tv.com/www/cgi-bin/links/admin1/category.def line 31, near "SubCatStyle"
Compilation failed in require at admin.cgi line 55.

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

Any suggestions where I should begin?




Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1<br> In reply to
In Reply To:
Error including libraries: Unmatched right curly bracket at /virtualhosts/p4k-tv.com/www/cgi-bin/links/admin1/site_html_templates.pl line 508, at end of line
syntax error at /virtualhosts/p4k-tv.com/www/cgi-bin/links/admin1/site_html_templates.pl line 508, near "}"
Compilation failed in require at nph-build.cgi line 33.
This is a known bug in the instructions. Replace all of site_html_print_cat with the codes provided in this thread (look at your stuff and see if you have a few pieces of redundant coding, specificly at the bottom).

In Reply To:
Error Message : fatal error: syntax error at /virtualhosts/p4k-tv.com/www/cgi-bin/links/admin1/category.def line 31, near "SubCatStyle"
Compilation failed in require at admin.cgi line 55.
You probably did not put a comma at the end of the previous field before adding SubCatStyle.

Happy Coding,

--Drew
http://www.FindingHim.com
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hi Kraken!
i see all subvcategories and when i click on category on category page on left upper corner i get
Category : (ALL)2
(ALL)2

Instead of category: Computers i.e.

can u take a look at
http://home.netsi.net/vstopnice/links/pages/
to see what i'm talking about..
thanks in advance
Gregor



Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I have a problem with this mod because I installed 3 Level of New Graphics mod. The subcategories are shoing up but the problem is not in the right place. Here is the code for

sub site_html_print_cat {
my (@subcat) = @_;
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
$columns = 1;
$output = qq|<table width="100%" border="0" cellspacing="0" cellpadding="0">\n|;
$output .= qq|<tr>\n|;
foreach $subcat (sort @subcat) {
my $mod = $stats{"$subcat"}[3];
my $new_add = $stats{"$subcat"}[4];
($description) = @{$category{$subcat}}[2];
($subcatstyle) = @{$category{$subcat}}[9];


$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];
if ($i == $columns) {
$output .= qq|</tr>\n<tr>|;
$i = 0;
}
$output .= qq|<td vAlign="top">\n|;
$output .= qq|<a href="$url">$category_name</a>\n|;
$output .= qq|<i>($numlinks)</i> \n|;
if ($new_add eq "Yes") {
$days_old = &days_old($stats{"$subcat"}[2]);
if ($days_old <= 2) { $output .= qq| $new_1|; }
elsif ($days_old <= 7) { $output .= qq| $new_3|; }
elsif ($days_old <= 14) { $output .= qq| $new_7|; }
}
if ($mod eq "Yes") { $output .= qq~ $updated~; }

$output .= qq|
|;
$output .= qq|$description\n| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</td>\n|;
$i++;

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 { }}


$output .= "</tr>\n</table>\n";
return $output;
}
1;


I don"t know what it"s doing but when I tried this for Business section at http://searchat.virtualave.net, instead of the subcategories being printed below Business, it printed directly above the whole categories.

Please help in correcting this.


SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I have added the mod in the hope of getting the (ALL)1 layout but subcategories are not displaying. I have added the modifications to links.cfg, added new field to category.def, deliniated the category.db, and modified the site_html_template.pl as follows:
# 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;
}

I am confused however about what is added to SubCatStyle in modify categories. As the field only accepts one line, which line of ALL 1 is meant to be inserted and is it to each category I want listed Yahoo-like or somewhere else. Quite simply, I want the subcategories to display under the category headings without any descriptions but with total number and "new" displaying when appropriate.

Your help is appreciated.

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Can someone please help me with the above problem.

SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
One line of your code looks like

$output .= qq|
|;

it is actually $output .= qq|< >|; with a br inside the < >. Your actual code is probably correct. Just this msg board accepts the html code.

----------------------------------------
But look at this

$output .= qq~<LI>~ if ($style eq "2");

mine looks like ( well now it does, but it did look like yours )
$output .= qq~ ~ if ($style eq "2");

I had to delete the <LI> from the above. While I am no HTML expert, removing it did wonders for my printing....!

I did the 3 levels of graphics mod also with the Yahoo mod....Looks great when I got it to work.

Gene


Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
The subcategories worked fine on my site. However once you click the main category on the home page.. the next page will display subcategories underneath the next set of categories.. i do not want this to display. I just want the normal set of categories listed to show.. How do i rid the subs from this page? is this something to be corrected on the category.html page or within the site_html_templates.pl file?

thanks
James (netman)

PS!!! I found the problem. It was in my editing of the categories. I had included the (ALL)1 notation by accident. THANKS GUYS.

But of course!
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Thanks Gene you helped me solve a problem, but your solution did nothing for me. When I looked closer at the code, the problem was in the table < /td > was in the wrong place. So I moved it from before if subcategories to after subcategories. Here is the code you look for

$output .= qq|</td>\n|;

and you remove that code and put that same code after
$output .= qq~<BR>~;
in the subcategories and now it is working fine for me. If I have any more problems I will post them here which I probably will.

Again thanks for the help gene,
Kevin
http://searchat.virtualave.net



SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hi!

I've installed this MOD, but am having problems using (ALL)1 as the Style. (ALL)2 works fine.

When using (ALL)1 I get , (commas) displayed but no sub cat names!

This happens wether I specify the Sub cat names manualy or by hand (i.e. all '2' style works, and none '1' style works.

I havn't modified the mod in any way...

Any ideas?

Thanks!

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
You are missing the $subcat_length variable as mentioned quite a few times in this forum....

Make sure that you have the variable in your links.cfg file and that you set it to a high number like 50....

Code:

$subcat_length = 50;


Good luck!

Regards,

Eliot Lee
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Is this the complete, tested, working and proven code for the Yahoo like subcategories mod?

Roberto Perez
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Yep...sure is...although there are a few bugs, but they have been cleared up in this forum.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
What page are you refering to below, it's the last part of the yahoo cat mod?
Also is there a place where I can get this mod with all the bugs worked out?
To use this mod indicate what style of subcategory listing
you would like by entering one of the
styles below in the SubCatStyle filed in the Modify Category screen of the Links Admin page.




Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
In Reply To:
What page are you refering to below, it's the last part of the yahoo cat mod?
PAGE 1 of this Thread...read the posts more carefully.

In Reply To:
Also is there a place where I can get this mod with all the bugs worked out?
Nope...just in this Thread.

In Reply To:
To use this mod indicate what style of subcategory listing
you would like by entering one of the
styles below in the SubCatStyle filed in the Modify Category screen of the Links Admin page.
Yep...Read the Mod instructions again.



Regards,

Eliot Lee
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I have a problem with this mod. Where exactly is the
" SubCategoryStyle field in the category modify form ", where would it be, in what directory?,folder, what's the name of the file.
I can't seem to get this mod working.
http://www.primefind.com/cgi-bin/pages

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
You need to add the SubCatStyle field in your category.def (like mentioned in the MOD instructions) and then you need to upgrade your EXISTING categories.db as mentioned in the MOD instructions. Read them again.

Regards,

Eliot Lee
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hello,
I have tried installing this mod atleast 4 times and everytime I get the same result. When I build the pages and view the page it shows as (1). There is no category link just the #. Anyone have any ideas? I have read all 5 pages of this post thoroughly and searched this message board and it seems others have had the same problem as me.
Please Help,

Jason


Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
I just finished instaling this mod on my site yesterday, and it works great but I have a tiny glitch that I can't seem to overcome...

When I click on the category and go to the categories page, only one subcategory shows up... I was under the impression that all subcategories listed should showup...

http://www.talkstox.com/pages/Biotechs_and_Pharmaceuticals/

It's still under construction...

Can somebody please advise how to fix this problem...

Re: JasonSR... Can you provide a link to your site... I had quite a learning curve with the installation of this mod myself...

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
http://simreview.com/directory

i need some serious help
I have a template ready but i wanna get all my mods installed first.

Jason

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Put in a test category and build.... You've got a link but no category for it to go into...

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Many thanks to Paul Wilson for fixing my mess....

Again!!!!!!!!

...Ed

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
The problem is in the sub link home in nph-build.cgi I believe. It's been a while since I have done this. On the interface on the adminstration part only (all)2 works properly. You have to form the nphbuild.cgi that builds the page the way you want it to come out.

I hope this helps, if it doesn't let me know and when I find more time I will see what I did and let you know for sure.

SearchAt!- Directory of Services
http://webbusinessservices.hypermart.net
Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
http://www.simgoracing.com/Jason/directory/
you guys see how it doesnt show the main dir?

Im just gonna give up on this. Does anyone have widgetz old mod for this? If so i NEED it bad.

Jason

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Can anyone help?

I made some modifications to the site_html_templates a while back using variations to this mod I picked up from this forum, however I cant remember which alterations I got where.

Can anyone tell me how I modify the already modified code that follows to generate 2, or possibly 3 columns for the category output?

Thanks.

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="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;

sub byfield { $category{$a}[$cat_sort_field] cmp $category{$b}[$cat_sort_field] };
foreach $subcat (sort byfield @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];

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<BR><font size=2><a class="catlist" href="$url"><b>$category_name</b></a><font> <font size=2 class="catlist">($numlinks)</font> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|
|;
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");
$category_name =~ tr/_/ /;
$output .= qq~<font size=2><a class="subcat" href="$url">$category_name</a>~;
$s++;
last if ($subcatstyle ne "ALL" && $#subcatsub > 0);
}
$output .= qq||;
}
undef $length;
if ($s < $#{$subcategories{$subcat}}) {
$output .= qq~<font size=2>....(more)</font>~ if ($style eq "1");
}
$output .= qq~
<font size=2>$description</font>
~ if(!($description=~/^[\s\n]*$/))
}
else {
$output .= qq|<font size=2>$description</font>
| if(!($description=~/^[\s\n]*$/));
}}
# Don't forget to end the table..
$output .= "</td></tr></table></div>\n";
return $output;
}

Quote Reply
Main cats not showing up In reply to
Hello,

I am having the same problem as Jason was having. It seems he gave up. Here is what happens when I build: When I build the pages and view the page it shows as (1). There is no category link just the #. Anyone have any ideas? In every category the subs show up, but not the main cat itself. Only (3) or whatever. Can someone give me input on this? Here is the URL The site is not designed yet just basic Links so it's ugly.
http://www.isolove.net/...g-sites/Adults_Only/

Thanks,
Doug

You might look at this dir too;
http://www.isolove.net/dating-sites/

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

Hey, I'm really glad you posted this suggestion for change:
$output .= qq|<a class="catlist" href="$url">$category_name</a> <font class="catlist">($numlinks)</font> |;

I have went over this mod, and never got it to create the Main Categories. It would create the subs fine but NO Main Categories. I just found out it is because I was using this:
$output .= qq|<a class="catlist" href="$url">$description</a> <font class="catlist">($numlinks)</font> |;
Which adds the "description" in place of the main category name. I never added any descriptions for the categories as I did not want any so my "Main Categories" did not show up at all.

Thanks again, I appreciate it.

Doug

Quote Reply
Re: SUBCATEGORIES LIKE YAHOO v2.1 In reply to
Hello,
i,ve a problem with Style Types...
Vertical Layout (ordered by you)(Games|Utilites|Hacks)2

If I insert (Games)2
works,

but if I insert |(Games|Utilites|Hacks)2
don't works...
Wich is the problem..
Tanks


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