Gossamer Forum
Home : Products : Links 2.0 : Customization :

2 part question

Quote Reply
2 part question
I'm using (and modifying) Alex's templates (the best ones available boys andf girls!). My problem is two-fold, so far Smile

1 - I searched the forums for the method to create two category columns. This is what I found:

in site_html_templates.pl modify:

Sub site_html_print_cat {

my ($half) =int(($#subcat +2)/2);

Well, I did that... changing the twos(2) to threes(3) (since it was already twos in the beginning, but only showed categories in one column?!? Any ideas?

Also, under Navigator 4.05 for mac there are lines between each category. However, when viewing with I.E. 4.5, also mac, there are NO lines between categories??? Why? And are there any methods to see what things will look like on Web TV without having access to WebTV?

Thanx in Advance!
Quote Reply
Re: 2 part question In reply to
I don't have an answer for the first part, but as an FYI the line differences show up in IE 5 and NS4.06 on my PC too.

I've never actually tried to create lines with table cell spacing and background colors before...it appears that IE won't allow the underlying tables background color to show through when the top table's bgcolor is defined in the table tag. I would suggest removing the bgcolor from the table tag and defining it in the category level td tag instead. This should allow IE to treat the cellspacing area as transparent letting the underlying table color show through, but shouldn't affect rendering by NS.

Welcome to the ever exciting world of browser incompatability!
Quote Reply
Re: 2 part question In reply to
If you are getting lines between the categories and there are no borders (or you have border=0 in the <table> tag), try adding the parameter "cellspacing=0" to the <table> tag. I recently had a table that was putting lines between the rows and it was driving me nuts (it was a table with a black background on a page that had a white background, and white lines were showing between the rows even though I had included border=0). The cellspacing command cleared that up for me.

I don't understand the first part of your problem. The default templates build the categories in 2 columns on my system, not one as you have said. If you change the 2's to a 3, then you end up with 3 columns of categories.
Quote Reply
Re: 2 part question In reply to
Bobsie,

I don't think that I changed anything on my system except that I installed Alex's mods and the nested if mod. Still when doing categories are listed in 1 column straight down the page...

Also, I tried your fix for the lines between categories and it did work (THANX!). Do you think that because each category is in it's own row that this keeps things from listing in two categories?
Quote Reply
Re: 2 part question In reply to
Bobsie,

I tried it, killed my cache and then did a rebuild and nothing happened??? Did I miss something?

########################################################################################

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

foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];

# 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">\n|;
}
$i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<tr><td><font face="Verdana, Helevtica, Arial" size=2><dl><dt><strong><a href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<small><font color="red">new</font></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></font></td></tr>|;
}

return $output;
}

1;
Quote Reply
Re: 2 part question In reply to
Change:

Quote:
my ($half) = int (($#subcat+3) / 3);

back to:

Quote:
my ($half) = int (($#subcat+2) / 2);

I hope this helps.
Quote Reply
Re: 2 part question In reply to
Oops...I thought you WANTED the lines. Sorry about that! Since you aren't using it to create a border or lines, you may want to go ahead and remove the underlying table (the one that had the bgcolor set to 000000). It doesn't seem to serve any other purpose, and is just one more nested table laying around to slow things down.

Quote:
Do you think that because each category is in it's own row that this keeps things from listing in two categories?

Yep...that's exactly why. I haven't downloaded Alex's templates...did they come with a new site_html_templates.pl? If so, I suspect that Alex changed it so it is ending both the cell and the row after each cat. If you still have the original, examine it for the correct code to create columns (the last section of the file)--you probably can just cut and paste it into your file, then just add the font codes or whatever else you need to match your page.

You may want to try the aligned table row mod Bobsie posted a few days ago at:
http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/001783.html

Even if you don't have descriptions, I like it better because it alphabetizes the cats more logically (IMHO)--you get to read across the page instead of down the column.
Quote Reply
Re: 2 part question In reply to
anachron,

Try this.

Right after the following line of sub site_html_print_cat of site_html_templates.pl:

Code:
# 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">\n|;
}
$i++;

That code is what is in sub site_html_print_cat of site_html_templates.pl in the default Links distribution and is what controls the second column.

I hope this helps.
Quote Reply
Re: 2 part question In reply to
I am having a similar problem. I want two columns with the resource center type templates.When I change category numbers (/2...etc) it changes nothing.

Thanks, Aaron

------------------
www.serve.com/garden/geosearcher





[This message has been edited by Aaron (edited June 19, 1999).]

[This message has been edited by Aaron (edited June 19, 1999).]

[This message has been edited by Aaron (edited June 19, 1999).]
Quote Reply
Re: 2 part question In reply to
It looks to me as if you are using the site_html_templates.pl that comes standard with links instead of the one in the Resource Center archive. The one in the Resource Center archive does not have and opening and closing table in it, it just has the <tr></tr> and <td></td> pairs. The table is created externally from that subroutine.

I hope this helps.
Quote Reply
Re: 2 part question In reply to
Yes, I am using the site_html_templates.pl that comes standard with links instead of the one in the Resource Center archive. This is because I wanted to get two columns, and I didn't think the resource center templates had that capability. I am only calling the category script in home.html using the tag and it is not nested in any tables. Am I wrong to think that if I changed the site_html_templates.pl to the original one, that I could use the two column feature? I also tried to change things around with the resource center site_html_templates.pl, but couldn't get two columns.

Aaron

------------------
www.serve.com/garden/geosearcher



Quote Reply
Re: 2 part question In reply to
Ok Here is what I have (I started from the basics...The resource center templates):


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

foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];

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

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<tr><td><font face="Verdana, Helevtica, Arial" size=2><dl><dt><strong><a href="$url">$category_name</a></strong> <small>(There are $numlinks in this category)</small> |;
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|</dt>|;
$output .= qq|<dd><span></font><font face="Verdana, Helevtica, Arial" size=1>$description </span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl></font></td></tr>|;
}

return $output;
}


and my home.html reads:

<div align="center"><center>

<table border="0" width="95%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC"><font face="Verdana, Helvetica" size="4"><b>Categories</b></font></td>
</tr>
<tr>
<td bgcolor="#F7F7F7"><font face="Verdana, Helvetica, Arial" size="2"><%category%> </font></td>
</tr>
</table>
</td>
</tr>
</table>
</center></div>

and my category.html reads:

<%if category%>
<div align="center"><center>

<table border="0" width="95%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#CCCCCC"><font face="Verdana, Helvetica" size="3"><b>Categories in <%category_clean%></b></font></td>
</tr>
<tr>
<td bgcolor="#F7F7F7"><font face="Verdana, Helvetica, Arial" size="2"><%category%> </font></td>
</tr>
</table>
</td>
</tr>
</table>
</center></div><%endif%>


I am trying to get two columns out of this on my main page (home.html).

Hopefully I have included enough info here.

Aaron



------------------
www.serve.com/garden/geosearcher



Quote Reply
Re: 2 part question In reply to
I just installed the Resource Center templates and used the original site_html_templates.pl script that comes with Links. All the categories are displaying in two columns.

It has this code:

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

# Then we print out the name linked, new if it's new, and popular if its popular.

I hope this helps.
Quote Reply
Re: 2 part question In reply to
Thanks, Bobsie
I changed everything to the original site_html_templates.pl, then I figured out that the way I was displaying my categories is what was killing my columns. I just re designed my new category display and it works great.

Thanks again,

Aaron

------------------
www.serve.com/garden/geosearcher