Gossamer Forum
Home : Products : Links 2.0 : Customization :

Not Display New And Number Of Links

Quote Reply
Not Display New And Number Of Links
Hiya,
I have just installed the Subcategories Like Yahoo Mod and have been trying to not show the amount of links in a catagory and the 'new' on my main page with no success.
I am not too sure which part of the code to take out in my site_html_templates.pl

Any help would be GREATLY appreciated :)

P.s Sorry if this kinda Q has been answered before, but I have spent the last 2 hrs searching with no luck :(



Quote Reply
Re: Not Display New And Number Of Links In reply to
In site_html_templates.pl find the sub site_html_print_cat routine.

Find the line

Code:
$output .= qq|<dl><dt><strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small>
Copy the entire line and paste it just below the original line. Comment out the original line by putting a # at the beginnning of the line.

On the new line delete
Code:
<small class="numlinks">($numlinks)</small>
Now, just below that should be

Code:
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
Just comment it out by putting a # at the beginnning of the line.

When you are satisfied you will no longer EVER need them, you can delete the commented out lines. I'd probalbly leave them just in case.


Gene
Quote Reply
Re: Not Display New And Number Of Links In reply to
Hiya,
Thank you sooo much for that.. I got half of it done.. My code didnt look quite what you said. Probably due to the mods i have added.. Everything is done except I now just have () next to the catagories. How can i remove those ?

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);
$columns = '3'; #number of columns
my ($half) = int (($#subcat+2) / $columns);


# Print Header.
$output = qq|<div class="margin"><table width="95%" border="0" cellspacing="3" cellpadding="3"><tr><td class="catlist" valign="top">\n|;

foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
($subcatstyle) = @{$category{$subcat}}[8];
$sub = "";
open (DB, "<$db_category_name") or &cgierr("unable to open database: $db_category_name. Reason: $!");
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$name{$values[0]} = $values[1];
}
close DB;
foreach $values (sort {$name{$a} <=> $name{$b}} keys %name) {
if ($name{$values} =~ m,^$subcat/([^/]+)$,) {
if ($name{$values} =~ m,.*/([^/]+)$,) { $nam{$values} = &build_clean($1); } else { $nam{$values} = &build_clean($subcat); }
$sub .= "<a href =$name{$values}>($nam{$values}) </a>\n";
}
}


# 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 = 0;

}
$i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
%cat_rec = (url => $url,
numlinks => $numlinks,
category_name => $category_name,
description => $description,

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

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"><font size=2 face=comic sans ms>$category_name</font></a>~;
$s++;
last if ($subcatstyle ne "ALL" && $#subcatsub > 0);
}
}
undef $length;
if ($s < $#{$subcategories{$subcat}}) {
$output .= qq~...~ if ($style eq "1");
}
$output .= qq~<BR><BR><BR>~;
}
else { }}
# Don't forget to end the table..
$output .= "</td></tr></table></div>\n";
return $output;
}


Quote Reply
Re: Not Display New And Number Of Links In reply to
Where did you delete the word $numlinks? The ( ) should be at the same place.

Check the routine site_html_category_link.

Yep, the site_html_print_cat routine maybe the most hacked routine in links. What is the other MOD you have installed?


Gene
Quote Reply
Re: Not Display New And Number Of Links In reply to
I couldnt find the line you mentioned.. All i could find was this :
# 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];

I commented the line with $numlinks in it...

I added the yahoo subcatagory mod and the Span pages mod..

Quote Reply
Re: Not Display New And Number Of Links In reply to
You commented out the two lines that calculated the number of links and whether or not any of them were new.

Now you need to find where the category info is actually printed out. The only place I see is in the line

$output .= &site_html_category_link;

which is just below where you commented out the calculation of the new flag.

Look at the sub site_html_category_link routine and see if the number of links is printed out there.

Gene
Quote Reply
Re: Not Display New And Number Of Links In reply to
Doesnt seem to be there either ~sigh~
Here is how it looks :

# Then we print out the name linked, new if it's new, and popular if its popular.
%cat_rec = (url => $url,
numlinks => $numlinks,
category_name => $category_name,
description => $description,

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

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"><font size=2 face=comic sans ms>$category_name</font></a>~;
$s++;
last if ($subcatstyle ne "ALL" && $#subcatsub > 0);
}
}
undef $length;
if ($s < $#{$subcategories{$subcat}}) {
$output .= qq~...~ if ($style eq "1");
}
$output .= qq~<BR><BR><BR>~;
}
else { }}
# Don't forget to end the table..
$output .= "</td></tr></table></div>\n";
return $output;
}

sub site_html_category_link {
# --------------------------------------------------------
# This routine is used to display what a category link should
# look like.

return &load_template ('category_link.html', {
%cat_rec,
%globals
});
}

1;

I have manged to remove the 'new' and the number of links in the catagories, now all I need to find is how to remove the ( ) that are sitting beside the catagories..


Quote Reply
Re: Not Display New And Number Of Links In reply to
The whole point of the category link template was to make editing site_html_print_cat easier but you have proven me wrong! All you have to do is remove the tags from the template!

--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
Quote Reply
Re: Not Display New And Number Of Links In reply to
Ummmm... Errr Which Template Dude ??
Soooooorrrryyy :)

Quote Reply
Re: Not Display New And Number Of Links In reply to
category_link.html

LOOK at the codes you added!

Code:

sub site_html_category_link {
# --------------------------------------------------------
# This routine is used to display what a category link should
# look like.

return &load_template ('category_link.html', {
%cat_rec,
%globals
});
}


Regards,

Eliot Lee
Quote Reply
Re: Not Display New And Number Of Links In reply to
Thaaaaaaank You. I actually installed that mod and kinda left it alone after not really understanding what it was for. Yes silly but Hey, guess I know now :)

Thanks again...