Gossamer Forum
Home : Products : Links 2.0 : Customization :

1 colum sub category

Quote Reply
1 colum sub category
how can I make my Sub-Categories like this

Books
Magazines
Articles

Right now I have it like this

Books Magazines
Articles

Please Help

Marc Parish
http://www.todayslearning.com


Quote Reply
Re: 1 colum sub category In reply to
This has been discussed MANY times in this forum...Please bookmark this Thread for future reference...because I will not post the codes again...

Wink

Anyway...

1) You will need to have two sub site_html_print_cat routines in the site_html_templates.pl or site_html.pl files depending if you are using templates. Copy the sub site_html_print_cat routine and name the new sub-routine sub site_html_print_subcat.

2) In this new sub-routine (sub site_html_print_subcat), delete the following codes:

Code:

if ($i == $half) {
$output .= qq|</td><td valign="top" width="50%">\n|;
}
$i++;


3) Then in your sub build_category_pages routine in the site_html_templates.pl file, replace all occurences of &site_html_print_cat with &site_html_print_subcat.

4) Re-build your index/directory.

Voila...there you have it.

Regards,

Eliot Lee
Quote Reply
Re: 1 colum sub category In reply to
I dont understand how to do it, When I tried it I got errors, where I could not build. Can you help me a little more.

Thank you
Marc Parish
http://www.todayslearning.com

Quote Reply
Re: 1 colum sub category In reply to
What problems are you having with the Mod?
What Error messages are you receiving?

Be more specific and we may be able to help you.

Regards,

Eliot Lee
Quote Reply
Re: 1 colum sub category In reply to
This is the part I don't understand:

3) Then in your sub build_category_pages routine in the site_html_templates.pl file, replace all occurences of &site_html_print_cat with &site_html_print_subcat.

Is that in the cgi scripts you are talking about? or where?

Marc Parish
http://www.todayslearning.com


Quote Reply
Re: 1 colum sub category In reply to
In Reply To:
Is that in the cgi scripts you are talking about? or where?
The codes are in the nph-build.cgi script!

Regards,

Eliot Lee
Quote Reply
Re: 1 colum sub category In reply to
This still gives me 2 colums.

Computer:
Downloads Program
like that. what am I doing wrong? I even looked at the temp late category.html and made it look like this:

<%if category%>
<p>Sub-Categories</u>:</strong>



</p>

<Ętegory%>
<%endif%>

What am I doing wrong?


Quote Reply
Re: 1 colum sub category In reply to
<Ętegory%> <---- this is category
and still no good


Quote Reply
Re: 1 colum sub category In reply to
Uh...it should work...because I have the following codes in my sub site_html_print_cat (don't be concerned about the name) and guess what? I have one column of categories....

Here is my sub site_html_print_cat (published for the fifth time now in this forum)....

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 align="center"><center><table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td valign="top" width="50%">\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 valign="top" width="50%">\n|;
# }
$i++;
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<font face="Verdana" size="2"><b><a href="$url">$category_name</a></font></b> <font face="Verdana" size="1">($numlinks)</font> |;
my $days_old = &days_old($mod);
if ($days_old <= 2) {
$output .= qq| $new_1|;
}
elsif ($days_old <= 7) {
$output .= qq| $new_3|;
}
elsif ($days_old <= 14) {
$output .= qq| $new_7|;
}
$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~<font face="Verdana" size="1"><a href="$url">$category_name</a></font>~;
$s++;
last if ($subcatstyle ne "ALL" && $#subcatsub > 0);
}
}
undef $length;
if ($s < $#{$subcategories{$subcat}}) {
$output .= qq~...~ if ($style eq "1");
}
$output .= qq~<BR><BR>~;
}
else { }}
# Don't forget to end the table..
$output .= "</td></tr></table></div></center>\n";
return $output;
}


Notice that I have remmed out # all the $half codes...

I betcha that you inadvertantly deleted the $i++; codes AFTER the following codes:

Code:

if ($i == $half) {
$output .= qq|</td><td valign="top" width="50%">\n|;
}


You need to keep the $i++; codes in order for the categories to print.

Look at the following web page (if you don't believe me):

http://anthrotech.com/pc/

Then you can look at my Category pages, and you will see that I have categories in two columns...I have basically switched the codes I've given in this Thread and other Threads.

Wink

Regards,

Eliot Lee
Quote Reply
Re: 1 colum sub category In reply to
ok, I copied your code and put it in mine, and still 2 colums. can you take a look at it please, I have been on this for almost 24 hours, maybe you can see what im doing wrong?

Click on Computers & Internet category and you will see what im taking about. Sorry I don't understand this, but im tring.


Marc Parish
http://www.todayslearning.com

Quote Reply
Re: 1 colum sub category In reply to
Well...if the sub site_html_print_cat codes are not the problem...then you have probably botched the codes in the sub build_category_pages in the nph-build.cgi file!

* Did you replace ALL occurences of &site_html_print_cat with &site_html_print_subcat in the nph-build.cgi? Check again!

And you need to re-name the sub I posted to sub site_html_print_subcat!

Regards,


Eliot Lee
Quote Reply
Re: 1 colum sub category In reply to
still nothing and I reinstalled most of the files from links 2.0 zip. Can you think of anything I might be doing wrong? Where can I send my pwds to you at, maybe you can check it out for me, right now im getting a tired of sitting here and still not found anything I might have done wrong. I looked over everything and still found nothing. All links scripts are good, and the script you just did, mine is the same.

Marc Parish
http://www.todayslearning.com

Quote Reply
Re: 1 colum sub category In reply to
thank you its working, now 1 more question....I feel better this morning. how do I get a rid of the (1) or how many links are next to the sub categories?

Marc Parish
http://www.todayslearning.com

Quote Reply
Re: 1 colum sub category In reply to
Never mind I figured it out.

Quote Reply
Re: 1 colum sub category In reply to
Glad you figured it out...And for benefit of other LINKS users, you need to delete the $numlinks variable in the sub site_html_print_cat routine in the site_html_templates.pl file to remove the number of links next to categories.

Regards,

Eliot Lee