Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Solution for infinate column links

Quote Reply
Solution for infinate column links
hi,

i've made a global that'll let you have your links in "any" number of columns - 1,2,3... 500.

again it's an extension of this initial mod...

2 column links code

here's how you do it...

1. make a global called "finishcolumns"

Code:
sub {
#-------------------------------------------
# Prints an infinate number of table td tags
#
my $row = shift ;
my $columns = shift ;

my ($html, $i);

for ( $i = $row ; $i % $columns ; $i++ ) {
$html .= q|<TD>&nbsp;</TD>|;
}

return $html;

}



2. replace this code from the 2 column mod...

Code:
<%ifnot row_num % 2%> <%-- close the row --%>
</TR>
<%endif%>

<%if last%> <%-- close the table --%>

<%if row_num % 2 eq 1%> <%-- balance the trailing rows --%>
<TD></TD><TD></TD>
<%endif%>
</tr>
</TABLE>
<%endif%>


with this...


Code:
<%-- set the number of link rows --%>
<%set rows = 3 %>

<%ifnot row_num % $rows %> <%-- close the row --%>
</TR>
<%endif%>

<%if last%> <%-- close the table --%>
<%finishcolumns ($row_num, $rows)%>
</tr>
</TABLE>
<%endif%>


Then you can just set the number of link columns you want to have in <%set rows = 3 %> and it'll automatically fill in the blanks.


regan.

Last edited by:

ryel01: Jun 15, 2002, 2:37 PM