Gossamer Forum
Home : Products : Links 2.0 : Customization :

Some categorys displaying, others not.

Quote Reply
Some categorys displaying, others not.
Hi All,

I installed the Yahoo link Sub-categorys v2.1 and seem to have run into a problem. I know that there is a tread about the sub-cats, but I didn't see anything like the problem I'm having. I added a category named Internet, then I added a sub-category named Internet/Hosts. Neither the Internet nor the Internet/Hosts shows up on the main page. I even tried just adding the Internet cat. without any subs, and added a link to the Internet cat. It still doesn't show on the main page, but if I search it finds it ok. I don't even know which file handles all this. Please help!
Quote Reply
Re: Some categorys displaying, others not. In reply to
Did you build your directory? (Clicking on Build All after you added the Category and sub-categories.)

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: Some categorys displaying, others not. In reply to
Yup, I built it and even refreshed to make sure I wasn't looking at a cached copy. Had the same problem when I first got done adding the mod. I had the test category and added a construction and construction/general. Neither of the construction cats. showed, I deleted them and the test cat., reinstalled the Construction cats. and they showed up. I've tried deleting the Internet and Internet/Hosting cats. and reinstalling them, still the same thing, only the Construction cats. show up. Thanks in advanced!

Mike
Quote Reply
Re: Some categorys displaying, others not. In reply to
Somebody Please Help!
Quote Reply
Re: Some categorys displaying, others not. In reply to
I would re-read the Mod instructions and make sure that you have installed all the needed codes and that you have also updated your categories.db file with the new field you added to the category.def.

How do you do this? Read the recent Topics in this forum about upgrading/updating the categories.db 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: Some categorys displaying, others not. In reply to
Hi Eliot,

I had an empty category.db when I added the mod. I tried posting the following message in the Yahoo thread, but it's been 2 days with no reply, so I thought I put a copy here and see if you could help.

Thanks!

Mike

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



[This message has been edited by Mikeach (edited May 12, 2000).]
Quote Reply
Re: Some categorys displaying, others not. In reply to
Here are some mistakes I found:

1) You do not need the $subcatstyle tag defined in the sub site_html_category routine.

Delete the following codes:

Code:
subcatstyle => $subcatstyle,

2) The following codes:

Code:
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~; }

Need to replace the following codes:

Code:
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);

Delete these codes and put the other codes in its place.

3) Then the following codes need to be deleted all together:

Code:
$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;

BTW: In the future, please save your pertinent files as TEXT files, upload them to a publicly accessible directory in your server, and then post URLs to the TEXT files. Reading page upon page of codes is hard in these forums. It is a lot easier to read through TEXT files rather than codes posted in this forum.

Hope this makes sense....I think you have gotten quite confused installing multiple Mods at once. Try installing ONE mod at a time, then when the Mod is stable (meaning that there are no bugs), add another Mod.

Some suggestions:

1) Keep a backup of all your working files.
2) Keep history notes in your files, like the following:

Code:
# Subcat Mod codes installed
# Date
# Author
# Web Address of Instructions
# Forum Topic link if necessary

---CODES----

# End Subcat Modification

3) Keep a detailed history file of all modifications, which should include the following information:

* File
* Sub-routine
* Date Added
* Mod Author
* Web Site Address/Topic link
* Description

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: Some categorys displaying, others not. In reply to
Hi Eliot,

Ok. think I did everything you told me to do, but now I'm downloading nph-build.cgi. Inside I get this message:

Error including libraries: Missing right bracket at d:/www/maine-business/cgi-bin/links/admin/site_html_templates.pl line 493, at end of line
syntax error at d:/www/maine-business/cgi-bin/links/admin/site_html_templates.pl line 493, at EOF

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

Here's the very end of the file:

}
else { }

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

}

1;

The complete file is @ www.maine-business.com/site_html_templates.txt

I know it's something simple, but when I add a } at the end I just get another error. Thanks!!!

Mike
Quote Reply
Re: Some categorys displaying, others not. In reply to
Deja vu...Didn't I tell you or someone about matching brackets!

Wink

Anyway...you need to add a closing right bracket after the following codes:

Code:
return $output;

Like the following:

Code:
return $output;
}

Best of luck!

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: Some categorys displaying, others not. In reply to
Wasn't me you told..... Anyway, Like so, correct?:

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

1;


or do I add a second }? I tried both but either way I get that same error. I tried refreshing, and deleting all the temp. internet files from my browser, but the same thing. I'm starting to feel pretty stupid about all this. I REALLY appreciate all your help.

Mike
Quote Reply
Re: Some categorys displaying, others not. In reply to
There has to be TWO right brackets after the return $output;...

One to close the loop and the other to close the sub-routine, like the following:

Code:
return $output;
}
}

*sigh*

Wink

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: Some categorys displaying, others not. In reply to
Ok, it runs now, but I see no sub categorys at all and only one top level category out of three. I can appreciate the "sigh".... I feel like a friggin idiot trying to figure this out. It's not a hard mod to install, the instructions seem pretty clear....Oh, and I didn't add all the mods at once, I did the 3 new/update first, checked it all out, then added the password, checked it out, and then added the Yahoo mod. Anyway, now I'm really lost....

Mike
Quote Reply
Re: Some categorys displaying, others not. In reply to
Do you have the following value in your SubCatStyle field in your top level categories?

Code:
(ALL)2

Also, have you defined the following variable in your links.cfg file?

Code:
$subcat_length = 30;

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: Some categorys displaying, others not. In reply to
Ok, from this:

Do you have the following value in your SubCatStyle field in your top level categories?

code:
--------------------------------------------------------------------------------

(ALL)2

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

I take it you mean from the admin, not hardcoded into the script? If so, then yes. The next part:


Also, have you defined the following variable in your links.cfg file?


code:
--------------------------------------------------------------------------------

$subcat_length = 30;

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


Nope, not there! Where should I place it in the links.cfg? BTW, here's the link I got the mod from, I don't see anything about the last part in the instructions. That would be while it's not working <grin>.

http://gossamer-threads.com/scripts/resources/Attach/1072-MyMod.txt

Thanks for ALL your help and ALL your patients <sp?>!!!

Mike
Quote Reply
Re: Some categorys displaying, others not. In reply to
 
Quote:
Nope, not there! Where should I place it in the links.cfg?

Anywhere.

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: Some categorys displaying, others not. In reply to
Same thing..... I have 2 top level categorys, Construction and Internet, and 2 sub-categorys, construction/general and internet/hosts. The only category I see at all is Construction, no internet, or the subs. Tell me what you need to see, if it's more then one file I'll zip it togeather and make it downloadable. Again, Thanks....

Mike
Quote Reply
Re: Some categorys displaying, others not. In reply to
Save the following files as text files (do not zip them...I do not want to download them...I would prefer to open them individually from my web browser)....

1) links.cfg
2) site_html_templates.pl
3) category.def
4) categories.db
5) nph-build.cgi

Save them as:

1) links.txt
2) site_html_templates.txt
3) category.txt
4) categories.txt
5) nph-build.txt

Upload the text files to a publicly accessible directory in your web server, and then provide the URLs to the text files!

*SIGH*

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: Some categorys displaying, others not. In reply to
Cool, ok the files are at:

www.maine-business.com/txt

I can't wait to tackle my next mod, Webadverts! <GRIN>.....

Thanks,

Mike
Quote Reply
Re: Some categorys displaying, others not. In reply to
I said publicly accessible directory, not a directory where Directory Browsing is denied.

Either turn on directory listing, or link the text files individually in this Topic.

Come on, work with me here.

Wink

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: Some categorys displaying, others not. In reply to
Okay...

Here is my de-bugging report for your files.

1) links.cfg - OK
2) site_html_templates.pl - SYNTAX ERRORS

Copy ALL the following codes and replace them with what you have:

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, $subcatstyle, @subcatsub, $length, $s);
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);
}
$mod = $stats{"$subcat"}[3];
$new_add = $stats{"$subcat"}[4];
$numlinks = $stats{"$subcat"}[0];

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

if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {
($subcatstyle, $style) = ($1, $2);
$s = 0;
@subcatsub = split (/\|/, $subcatstyle);
$output .= qq| &nbsp|;
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 won't even go into the number of syntax errors I found...I lost count at 10.

3) category.def - OK

4) categories.db - OK

Although I would add more sub-categories to see the full effect of the Subcategories Mod.

5) nph-build.cgi - OK

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: Some categorys displaying, others not. In reply to
Hi Eliot,

It's:

http://www.maine-business.com/txt/links.txt

http://www.maine-business.com/txt/category.txt

http://www.maine-business.com/txt/categories.txt

http://www.maine-business.com/txt/nph-build.txt

http://www.maine-business.com/txt/site_html_templates.txt


Hope that helps! I can read them fine like that, sorry for the mixup.

Mike

BTW, it's browseable now.
Quote Reply
Re: Some categorys displaying, others not. In reply to
Welp...I already posted my analysis...I figured out how to access all the files.

If this doesn't work...I would suggest re-installing the Subcategories Mod again.

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: Some categorys displaying, others not. In reply to
Ok, now I'm REALLY confused. I've been just cutting and pasteing right from whatever the mod said or whatever you told me to do, can't figure out why there would be all the errors. Anyway, I cut the code out of your message and pasted it exactly has you had it, right where you said. Ran the build and got the dreaded download nph-build.pl. I looked inside it and it said an unmatched right bracket on line 506. I deleted one of the 2 brackets at the bottom and the script runs, but....
now it shows Construction on the left and Internet on the right, instead of on top of each other, and no sub-categories. I know, *SIGH*..... I'm going to wait until tomorrow and start all over I guess. I'll add the Yahoo first this time. I uploaded the new site_html_templates.txt, in case you feel like checking it out. If not, I fully understand.....What a headache... Thanks once again for all your help!

Mike