Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

2 Column Category - Same Width

Quote Reply
2 Column Category - Same Width
I use 2 Columns for my Category I have beat my brain, tried every thing I could come up with and searched all the boards.

I need the Columns to both be the same width, basically 250 wide each. Or just the same width.

Anybody have any ideas??

http://www.sfahq.com
Phil the FOG
Quote Reply
Re: 2 Column Category - Same Width In reply to
You need to look in HTML_Templates.pm for this section: sub site_html_print_cat

Find this part:

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

Change it to:

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

That's the table set to 500 pixels wide (you could still use a % if you wanted and replace the 250 for 50% - half the table) and the first column is now 250. Now for the second column ... find the following code a little further down:

# 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).
($i and ($i % $breakpoint)) or ($output .= qq|</td><td class="catlist" valign="top">\n|);

... and again, add the width setting:

# 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).
($i and ($i % $breakpoint)) or ($output .= qq|</td><td class="catlist" valign="top" width="250">\n|);

That should do it ... let me know how it worked out Smile

All the best
Shaun

Quote Reply
Re: 2 Column Category - Same Width In reply to
Using this method I wind up with a Cell to the left.
********************8
# Print Header.
$output = qq|<div class="margin"><table width="100%" border="0" cellspacing="4" cellpadding="0"><tr><td class="catlist" valign="top" width="504">\n|;
$i = 0;
foreach $cat (sort @names) {
$cat_r = $subcat->{$cat};

****************
# 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).
($i and ($i % $breakpoint)) or ($output .= qq|</td><td class="catlist" valign="top" width="504">\n|);
$i++;

***************
Is there a way to get the 3rd cell or left cell out



http://www.sfahq.com
Phil the FOG
Quote Reply
Re: 2 Column Category - Same Width In reply to
I had to put the original until it is figured out.

Here are some IFs

If I pull down from the web and repair in front page
This is the html I am trying to accomplish.

*****************************************************
align: Left; margin-top: 0; margin-bottom: 0" align="left"><TABLE width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#D0CC98"><TR><TD width="100%"><DIV align="center"><B><font color="#000080" size="5">CATEGORIES</font></B></DIV></TD></TR></TABLE></TD></TR></TABLE><FONT
face="Verdana, Arial, Helvetica" size=2><div class="margin"><table width="508" border="0" cellspacing="4" cellpadding="0"><tr><td class="catlist" valign="top" width="247">
*******************************************

http://www.sfahq.com
Phil the FOG
Quote Reply
Re: 2 Column Category - Same Width In reply to
Phil,

You haven't followed my example properly, you've made both columns 504 pixels wide in your version, which is too wide for the space on your page. Actually, a better way to display table cells is to use a percentage. This means that the page will 'flex' based on the screen resolution of your visitors desktop settings.

OK, lets try again with percentages instead Smile:

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

# 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).
($i and ($i % $breakpoint)) or ($output .= qq|</td><td class="catlist" valign="top" width="50%">\n|);

This will give you a TABLE that is 100% of the screen width where you are displaying it (even if its a nested table, i.e.; within another table cell)

In Reply To:
I need the Columns to both be the same width
This will also give you TWO columns, each with a width of 50% (half each).

Have another go, and if you don't get the results you expect come back and I'll try to help you by email :)

All the best
Shaun

Quote Reply
Re: 2 Column Category - Same Width In reply to
Just wanted to flag this with a post about the logic bug. Since this comes up on some searches:

http://gossamer-threads.com/...sc&Number=111799

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: 2 Column Category - Same Width In reply to
Pugdog

I've just gotten back into the Search Engine http://www.sfahq.com/ again on a part-part-time basis.

I did the scripts as you had suggested, however it is still the same.

I went through your sites and find that on your site http://www.girlfriends.com/ the same thing is happening.

Note that in your Categories: If you download it from the net, That we are forming 3 (Three) Columns with the first one blank and then 2 that are not even.


http://www.sfahq.com
Phil the FOG
Quote Reply
Re: 2 Column Category - Same Width In reply to
Well I solved it the manual way.

HTML, I just put the "< BR >" in where I wanted it to break.

Until there is a better way.

I sure do appreciate everyone's help and support.

http://www.sfahq.com
Phil the FOG
Quote Reply
I have fixed the bug In reply to
a logic bug exist in Links SQL 1.13, you can fix it, details below (all are based Standard Links SQL 1.13):

in file HTML_Templates.pm

before line 620:

# Print Header.

add a line:

my $column_width = int(100/$LINKS{build_category_columns});

change line 621:

$output = qq|<div class="margin"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;

to:

$output = qq|<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center"><tr><td valign="top" width="$column_width%">\n|;

change line 642~645:

($i and ($i % $breakpoint)) or ($output .= qq|</td><td class="catlist" valign="top">\n|);
$i++;
defined $dynamic and &load_user ($dynamic, $cat_r);
$output .= &load_template ('subcategory.html', { %$cat_r, %GLOBALS }, undef, $template);

to:

$i++;
defined $dynamic and &load_user ($dynamic, $cat_r);
$output .= &load_template ('subcategory.html', { %$cat_r, %GLOBALS }, undef, $template);
($i % $breakpoint) or ($output .= qq|</td><td valign="top" width="$column_width%">\n|);


That's all! The table will be the same width. Would you please report whether it work for you?

Quote Reply
Re: 2 Column Category - Same Width In reply to
The girlfriends site has bee "changed" it's between version 1.1x and 2.0

The other sites I'm running 2 columns on have no leading column. Although you might want to do that for spacing reasons. Just as I add an extra blank column between the two columns with links.

What do you mean by "even"

If you mean having the headers line up, that requires you to use split-tables and create rows, and gets complex, since you are building across a table row by row, rather than cell by cell.

The best way to do it, is just make sure your headers are only 1 line long, and every category has the same length description.

barring that, you'll need to edit the print_cat routine to handle dealing with two links at a time, or spacing the cells such that the link-nugget is top-aligned in each cell. This would still allow 1 line title to be next to a 2 line title, and be uneven. But, it's the only way.

See the custom mods forum in the "Multiple collums for links..." topic where I posted a mod for SQL NG that will do this for links. It will maybe explain what I'm trying to say. You'd have to build the categories the same way -- two rows at a time header/body then join them.


PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ


Quote Reply
Re: 2 Column Category - Same Width In reply to
Y'all

Sorry I failed to come back the other day and post, I tried CNUsers post but did not work either, I'm still solving it the manual way. With HTML, I just put the "< BR >" in where I wanted it to break and it keeps them even.

I still have not updated from 1.0, It is working Super. Just plain Chicken!!! Suppose I will have to one day soon, when I can gather the nerve and time.

Thanks for all the help....
Special Forces Search Engine

http://www.sfahq.com
Phil the FOG