Gossamer Forum
Home : Products : Links 2.0 : Customization :

Hiding Certain Categories

Quote Reply
Hiding Certain Categories
Hello,

I want to be able to exclude certain categories from showing up when I use $category on my pages. However, I still want the page for that category to be built when I build my pages. I tried in nph-build.cgi in sub build_category_pages doing

Code:
# Store all the category html info in $category.
unless (@{$subcategories{$cat}}[2] =~ /hide/) {
if ($#{$subcategories{$cat}} >= 0) {
$category = &site_html_print_cat (@{$subcategories{$cat}});
}
}
else {
$category = "";
}

This is not working, but if anyone can see what I am trying to do with this code can they please help.

Thanks,
Jon
Quote Reply
Re: Hiding Certain Categories In reply to
try something similar in sub site_html_print_cat in site_html_templates.pl. I'm not a perl person okay, but I believe you can exclude the link to the category from there, since this is what determines how the category list is displayed.

[This message has been edited by lordmouse (edited December 13, 1999).]
Quote Reply
Re: Hiding Certain Categories In reply to
Thanks for helping me with a solution, lordmouse. It works perfectly.
-Jon
Quote Reply
Re: Hiding Certain Categories In reply to
Glad it works.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Hiding Certain Categories In reply to
Jonathan

If you get a chance, could you explain how you did this and how to use this feature?

Thanks.
Quote Reply
Re: Hiding Certain Categories In reply to
Jonathan

yes please tell how you did this or any one else know.

Thanks

------------------
On-line Canada.com
http://www.on-linecanada.com
Internet Directory & Website Resource Centre
Quote Reply
Re: Hiding Certain Categories In reply to
Okay,

I went into site_html_templates.pl in sub site_html_print_cat and changed:

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

to

Code:
# Then we print out the name linked, new if it's new, and popular if its popular.
unless ($category_name =~ /Name of Category to Exclude/i) {
$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>|;
}

However, I had some trouble with this because I don't think that $category_name is in the form Category/Subcategory1/Subcategory2 so for the name of the category to exclude I used whatever Subcategory2 was.

I know this isn't really the best way to do this, so if someone does know the best way, please add your input.

-Jon
Quote Reply
Re: Hiding Certain Categories In reply to
This works fine, however, how can one also exclude the category from the pull down menu on the add form?

Regards,

Zaro
Quote Reply
Re: Hiding Certain Categories In reply to
Use the Category Select Mod written by Bobsie in the Resource Center.

Regards,

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