Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Alternating colours whilst looping through links

Quote Reply
Alternating colours whilst looping through links
Hi all,

I'm trying to alternate the background colour of the links that are displayed within the category.html template to make it clearer to see each link.

Effectively I need to just change the bgcolor for each row (alternating between two colors).

Any ideas how this should be accomplished? I'm not a programmer by heart so am just looking for a simple reliable way that will work,

Cheers,

Ross

*-*-*-*-*-*-*-*-*-*-*
Servicepals.com is an online community for serving and retired military men and women. Visit us at http://www.servicepals.com. Development by Rawnet Limited
*-*-*-*-*-*-*-*-*-*-*
Quote Reply
Re: [servicepals] Alternating colours whilst looping through links In reply to
If you are using the tag

<%links%>

then it's going to be difficult. If you are using the loop

<%loop links_loop%>
<%include link.html%>
<%endif%>

then it's very easy: just add something like

<tr bgcolor="<%if even%>#AAAAAA<%else%>#FFFFFF<%endif%>">

in links.html

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Alternating colours whilst looping through links In reply to
Hi Ivan,

Thank you for the information. It appears that I'm currently using <%links%> but could change this? My current code is:

<!-- Links in this category. -->
<%if links%>
<p><strong>LINKS:</strong></p>

<%if next_span%>
<!-- Next/Previous links if spanning pages. -->
<p><small>Pages: <%next_span%></small></p>
<%endif%>

<%links%>

<%if next_span%>
<!-- Next/Previous links if spanning pages. -->
<p><small>Pages: <%next_span%></small></p>
<%endif%>
<%endif%>

I'm a bit nervous, but should it work if I change this to:

<!-- Links in this category. -->
<%if links%>
<p><strong>LINKS:</strong></p>

<%if next_span%>
<!-- Next/Previous links if spanning pages. -->
<p><small>Pages: <%next_span%></small></p>
<%endif%>

<%loop links_loop%>
<%include link.html%>
<%endif%>

<%if next_span%>
<!-- Next/Previous links if spanning pages. -->
<p><small>Pages: <%next_span%></small></p>
<%endif%>
<%endif%>



And then modify the link.html file?

Ross

*-*-*-*-*-*-*-*-*-*-*
Servicepals.com is an online community for serving and retired military men and women. Visit us at http://www.servicepals.com. Development by Rawnet Limited
*-*-*-*-*-*-*-*-*-*-*
Quote Reply
Re: [servicepals] Alternating colours whilst looping through links In reply to
Yes, all you have to do is to replace

<%links%>

by

<%loop links_loop%>
<%include link.html%>
<%endif%>

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Alternating colours whilst looping through links In reply to
In Reply To:
Yes, all you have to do is to replace

<%links%>

by

<%loop links_loop%>
<%include link.html%>
<%endif%>

And edit link.html Wink

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] Alternating colours whilst looping through links In reply to
WooooHOOO!! You're a star!! Sly

Brilliant - yup, all okay now.

Many thanks for your help,

Ross

*-*-*-*-*-*-*-*-*-*-*
Servicepals.com is an online community for serving and retired military men and women. Visit us at http://www.servicepals.com. Development by Rawnet Limited
*-*-*-*-*-*-*-*-*-*-*
Quote Reply
Re: [servicepals] Alternating colours whilst looping through links In reply to
I've just been setting this up and surely

<%loop links_loop%>
<%include link.html%>
<%endif%>

should actually be

<%loop links_loop%>
<%include link.html%>
<%endloop%>

?
Quote Reply
Re: [CrazyGuy] Alternating colours whilst looping through links In reply to
Yeah, it should be.

Just a boo boo on my end Tongue

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!