Gossamer Forum
Home : Products : Links 2.0 : Customization :

How do I remove Main Cat & : after adding subcats mod?

Quote Reply
How do I remove Main Cat & : after adding subcats mod?
Needless to say, I added the subcategories mod, and would like to remove the main category and : before the subcategory in the related links.



That is MainCat : SubCat to simply SubCat.



I also am using webadverts and use the <%Category_Name%> tag. Unless I can strip the main category and the : I will have to change all the zone names.



I already scoured the forum looking for answers but came up wanting. Anyone got any suggestions of what to do or where to find the answers. A keyword anything would help.



Thanks,Jake
Quote Reply
Re: [awwa] How do I remove Main Cat & : after adding subcats mod? In reply to
Need more onfo... When you say "subcats mod," which one do you mean, exactly? Yahoo-style? Something else? Is this on the home/index page, or where?

Once we know more about what you have, and what you want, we can help better. I doubt you will need to rename 'zone' names, a simple code change will probably fix ya up... Can you provide an address, so we can see what you've done?


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] How do I remove Main Cat & : after adding subcats mod? In reply to
CB Resources Links 2 Mods:Subcat mod 2 (below)

nph-build.cgi And db_utils.pl also included.
Mod shows subcats on home page like so,
Automotive (19)
Auto Dealerships
Auto Insurance
Bikes-Motorcycle
Parts Accessories

Mod shows the following for <%category_clean%>

Automotive : Auto Dealerships

Related Categories
Automotive : Auto Insurance
Automotive : Bikes-Motorcycle
Automotive : Parts Accessories

Presently a Webadverts banner call

Zone=<:%category_name%>
Will be filled in with
Zone=Automotive/Auto Dealerships;
I need it to be Zone=Auto_Dealerships

There are several problems with this.

1) <:%category_clean%> I donít want Automotive : to show on category page titles and in related fields. I simply want the category name to show on category pages and the sub category name to show on sub category pages. I still need the URL to contain the full category and subcategory, just not print it where I specified above. I think the sub procedures that need changing are in nph_build.cgi below.

2) <:%category_name%> I also want the category name only, or if a category contains a sub category, the sub category only to be filled in for the zone=<:%category_name%> in banner calls. That means removing the category name and / if there is a sub category.

So I need to have a sub procedure that strips the (category name) and the ( : ) from categories with sub categories and store the results in a new variable to use for category page titles and related fields, and I need to have a sub procedure that strips the (category name and the (/) from categories with sub categories and store the results in a new variable to use for the zone calls.

See Attachment for the rest of the story.

Thanks for the help,

Jake
In Reply To:

Last edited by:

awwa: Sep 19, 2003, 9:03 AM
Quote Reply
Re: [awwa] How do I remove Main Cat & : after adding subcats mod? In reply to
Code:
Ok I figured it out after a few hours. You don't have to help me

for the related links update this in nph_build.cgi

# Calculate the related entries and put in a <LI> list.
@related = split(/\Q$db_delim\E/, $related); $related = "";
foreach $relation (@related) {
$related .= qq|<li><a href="$build_root_url/|;
$related .= &urlencode($relation);
$related .= qq|/$build_index">|;
if ($relation =~ m,.*/([^/]+)$,) { $related .= &build_clean($1);}
else {
$related .= &build_clean($relation);
}
$related .= "</a></li>";
}

#------------------------------------
#a little further down update this section
#----------------------------------------


$title_linked = &build_linked_title ($cat);
$title = &build_unlinked_title ($cat);
$total = ($#{$links{$cat}} + 1) / ($#db_cols + 1);
#$category_name = $cat;
if ($cat =~ m,.*/([^/]+)$,) { $category_name = &buildzone_clean($1);}
else {
$category_name = &buildzone_clean($cat);
}
$category_name_escaped = &urlencode ($cat);
#$category_clean = &build_clean ($cat);
if ($cat =~ m,.*/([^/]+)$,) { $category_clean = &build_clean($1);}
else {
$category_clean = &build_clean($cat);
}
#$category_clean = ($cat);


#then I added a buildzone_clean in db_utils.pl for my webverts banner #call variable of <%category_clean%>

sub buildzone_clean {
# --------------------------------------------------------
# Formats a category name for displaying.
#
my ($input) = shift;
#$input =~ s/_/ /g; # Change '_' to spaces.
$input =~ s,/, : ,g; # Change '/' to ' : '.
return $input;
}

Last edited by:

awwa: Sep 19, 2003, 2:30 PM
Quote Reply
Re: [awwa] How do I remove Main Cat & : after adding subcats mod? In reply to
Great! Glad you figured it out. It can be fun, sometimes... Thanks also for posting your solution, too many times people say "I figured it out" but don't explain how, in case someone else wants to know.

I don't use the 'related links' feature, so I guess I wasn't picturing the problem...


Leonard
aka PerlFlunkie