Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Links Per Row

Quote Reply
Links Per Row
Hi,

what file do I need to change so I can have more than 1 link per row

Thanks!
Quote Reply
Re: [shimmy1] Links Per Row In reply to
Hi,

This should work - it will put them into 3 columns:

Code:
<%loop links_loop%>

<%if first%> <%-- set up the opening table --%>
<table class="pctable">
<tr>
<%endif%>
<td valign="bottom">
<%include link.html%>
</td>
<%ifnot row_num % 3%> <%-- close the row --%>
</tr>
<tr>
<%endif%>


<%if last%> <%-- close the table --%>
<%if row_num % 5 eq 2%> <%-- balance the trailing rows --%>
<td></td>
<%elsif row_num % 5 eq 1%> <%-- balance the trailing rows --%>
<td></td><td></td>
<%endif%>
</tr>
</table>
<%endif%>

<%endloop%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links Per Row In reply to
You know what Andy, I think it would be really interesting to see how many of the Ginks users would deal if your internet were to go offline for a week.

I think GLinks is a great product, however if it was not because of the support and help from you, Laura, Adrian and few others, I don't think it would be equally fun to work on GLinks.

Thanks again for this nifty code and tons of help.

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Links Per Row In reply to
haha maybe we will see - as I'm off for next week anyway =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links Per Row In reply to
works great thanks! now just gotta figure out how to change it to 2 per row
Quote Reply
Re: [Andy] Links Per Row In reply to
I am only days away from the launch of Software Devil and you have to go on vacation - u r terrible man... well atleast one of us is gonna be relaxing in that case.. have fun.

Vishal
-------------------------------------------------------
Quote Reply
Re: [shimmy1] Links Per Row In reply to
Hi,

I thought I would convert that code to work with CSS, instead of loads of table cells etc.

Thsi should work fine for 2 columns:

Code:
<style>
.city_left_col {
float: left;
width: 275px;
}
.city_right_col {
float: left;
width: 275px;
}
</style>



<%set split = Links::Utils::column_split($links_loop.length, '2')~%>
<%loop links_loop%>

<%if row_num == 1%>
<div class="city_left_col">
<%endif%>

<%include link.html%>

<%if row_num == $split%>
</div>
<div class="city_right_col">
<%endif%>


<%if last%>
</div>
<div style="clear: both;"></div>
<%endif%>


<%endloop%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links Per Row In reply to
I want to list my links in 2 columns on the home page and 3 columns in the category pages.
I can't either of these codes to work. Where do I put them? What do I take out or replace (If anything)
Quote Reply
Re: [Sies] Links Per Row In reply to
Can you attach what you have in your category.html and home.html template - bit hard if you just say "its not working" Wink

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links Per Row In reply to
I haven't change the category template yet, just tried the home template first.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><%site_title%></title>
<%include include_common_head.html%>
</head>
<body id="home">
<%include include_accessibility.html%>
<div id="wrapper">


<div id="loginbar"><a href="<%config.db_cgi_url%>/user.cgi<%if user.Username%>?logout=1<%endif%>" class="<%if user.Username%>in<%else%>out<%endif%>"><%if user.Username%>Logout<%else%>Login/Register<%endif%></a></div>
<div id="logo"><h1><a href="<%config.build_root_url%>/<%home_index%>"><%site_title%></a></h1></div>
<%include include_header.html%>
<%include include_contentheader.html%>
<div id="ocwrapper" class="clear">
<div id="icwrapper" class="clear">
<%include include_leftsidebar.html%>
<div id="contentwrapper" class="shadowleft">
<%include include_contentwrapper_top.html%>
<div class="shadowtop"><div class="shadowtopleft"></div><div class="shadowtopright"></div></div>
<div class="shadowright">
<div id="content">
<%include include_content_top.html%>

<%set split = Links::Utils::column_split($category_loop.length, $home_category_cols)~%>



<%set split = Links::Utils::column_split($links_loop.length, '2')~%>
<%loop links_loop%>

<%if row_num == 1%>
<div class="city_left_col">
<%endif%>

<%include link.html%>

<%if row_num == $split%>
</div>
<div class="city_right_col">
<%endif%>


<%if last%>
</div>
<div style="clear: both;"></div>
<%endif%>


<%endloop%>

<div class="clear">


<%Plugins::ULTRAGlobals::All_Links_In_Category(510,'50')%>

<%if all_links_in_this_cat.length%>
<%loop all_links_in_this_cat%>
<%include link.html%>
<%endloop%>
<%endif%>



</div>

<hr>
<%loop links_loop%>

<%if first%> <%-- set up the opening table --%>
<table class="pctable">
<tr>
<%endif%>
<td valign="bottom">
<%include link.html%>
</td>
<%ifnot row_num % 3%> <%-- close the row --%>
</tr>
<tr>
<%endif%>


<%if last%> <%-- close the table --%>
<%if row_num % 5 eq 2%> <%-- balance the trailing rows --%>
<td></td>
<%elsif row_num % 5 eq 1%> <%-- balance the trailing rows --%>
<td></td><td></td>
<%endif%>
</tr>
</table>
<%endif%>

<%endloop%>

<hr>
<h4>There <%if grand_total != 1%>are<%else%>is<%endif%> <strong><%grand_total%></strong> link<%if grand_total != 1%>s<%endif%> for you to choose from!</h4>

<%include include_content_bottom.html%>
</div>
</div>
<div class="shadowbottom"><div class="shadowbottomleft"></div><div class="shadowbottomright"></div></div>
<%include include_contentwrapper_bottom.html%>
</div>
<%include include_rightsidebar.html%>
</div>
</div>
<%include include_contentfooter.html%>
<%include include_footer.html%>
</div>
</body>
</html>
Quote Reply
Re: [Sies] Links Per Row In reply to
Did you add the CSS?

Code:
<style>
.city_left_col {
float: left;
width: 275px;
}
.city_right_col {
float: left;
width: 275px;
}
</style>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links Per Row In reply to
To the luna.css? Yes
This way
<style>
.city_left_col {
float: left;
width: 275px;
}
.city_right_col {
float: left;
width: 275px;
}
</style>

and this way

.city_left_col {
float: left;
width: 275px;
}
.city_right_col {
float: left;
width: 275px;
}
Quote Reply
Re: [Sies] Links Per Row In reply to
You got an example URL I can see it at?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Links Per Row In reply to
Thanks I got it working. This works fine, but do you set it for 3 columns.

<%set split = Links::Utils::column_split($links_loop.length, '2')~%>
<%loop links_loop%>

<%if row_num == 1%>
<div class="city_left_col">
<%endif%>

<%include link.html%>

<%if row_num == $split%>
</div>
<div class="city_right_col">
<%endif%>


<%if last%>
</div>
<div style="clear: both;"></div>
<%endif%>


<%endloop%>
Quote Reply
Re: [Sies] Links Per Row In reply to
Hi,

Thats where it gets a little more complex =) I'd suggest using something based on what I use on one of my own sites:

Code:
.category_row {
width: 100%;
}
.category_col_split {
float: left;
width: 33%;
}

Code:
<%set link_num_rows = 3%> <%-- change this to "2" for the homepage, BUT be sure to also change the width of .category_col_split to reflect your column width! --%>

<%-- show links --%>
<div class="category_row">
<div class="category_col_split">
<%loop links_loop%>

<%include link.html%>

<%unless row_num % $link_num_rows%>
</div> <%-- close the row-fluid, ready to open new one if needed --%>
<%-- its not the last row, so lets open a new row. We close the category_row outside the loop if needed --%>
<%if not last%>
<div class="category_row"><%-- wanna start a new row now --%>
<%endif%>
<%endif%>

<%endloop%>

<%unless links_loop.length % $link_num_rows%>
<%-- dont close it, as we didn't open a new one... --%>
<%else%>
</div> <%-- close main category_row block --%>
<%endif%>
</div> <%-- end category_row --%>
<%-- / END show links --%>

The setup above is aimed for the 3 column category pages. If you want to change it to 2 columns, change this line:

Code:
<%set link_num_rows = 3%>

Then also be sure to change the width of .category_col_split to 50% (otherwise it will look weird and go onto another line)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!