Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Alternating Row Color

(Page 2 of 2)
> >
Quote Reply
Re: [tondelo] Alternating Row Color In reply to
Quote:
It's as if when I do this it's not calling my link.html template. I tried replacing the " .. " with <%links%> and it placed/repeated all the links in the odd cells..

Yes, because the example showed .. string as place holder Smile

Here's the fix again:
Code:
<table>
<%loop links_loop%>
<tr><td bgcolor="<%if even%>white<%else%>silver<%endif%>">
<include link.html%>
</td></tr>
<%endloop%>
</table>

Now I checked the whole code, and should work if everthing goes well.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Alternating Row Color In reply to
Sometimes I think things just aren't meant to be.. Crazy
I pasted your code in place of my <%links%> code. and get nothing...

I've attached a before and after image of what I'm getting so you can see what I'm seeing..
Quote Reply
Re: [tondelo] Alternating Row Color In reply to
Hehe, I should also read more the docs Wink
And I should not hurry so much with the answers... I'm busy now with my diploma work...

Code:
<table>
<%loop link_results_loop%>
<tr><td bgcolor="<%if even%>white<%else%>silver<%endif%>">
<include link.html%>
</td></tr>
<%endloop%>
</table>

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [tondelo] Alternating Row Color In reply to
Hi,

Shoot over LinksSQL access, and I'll take a quick look for you. Probably something simple, like a mis-positioned tag or such :)

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: [tondelo] Alternating Row Color In reply to
Note, you can anytime, use the
<%GT::Template::dump%>
tag, to display available tags in LSQL v2.2.x and below. LSQL 2.99 changed the syntax.

But WARNING, this should not be used on production site, so you should use on only on your offline site, or a test installation, only! You can limit the display to your registered username, so this can be made safe. I can dig the code for you if you need it.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Alternating Row Color In reply to
Quote:
I can dig the code for you if you need it.

Code:
<%if Username eq "Username"%>
<%GT::Template::dump%>
<%endif%>

Smile

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: [tondelo] Alternating Row Color In reply to
I went to the resources to find you something useful,
and came up with this fine example:
Displaying Links In Two Columns

It's a good example how looping works in the template.

Unfortunately there is no Template Tutorial in Links 2.2.x, but there will be in Links v3.x.

P.S.: Thanks, Andy Cool

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Mar 17, 2005, 10:07 AM
Quote Reply
Re: [Andy] Alternating Row Color In reply to
In Reply To:
Hi,

Shoot over LinksSQL access, and I'll take a quick look for you. Probably something simple, like a mis-positioned tag or such :)

Cheers

Hi Andy,

I shot it over to the addr you have in your sig..

Let me know if you have any question.
Quote Reply
Re: [tondelo] Alternating Row Color In reply to
All done :)

For future reference, this was the final code;

Code:
<table width="100%">
<%loop links_loop%>
<tr>
<td bgcolor="<%if even%>white<%else%>silver<%endif%>">
<%include link.html%>
</td>
</tr>
<%endloop%>
</table>

Enjoy =)

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] Alternating Row Color In reply to
Hmmm... This is the same code I suggested in my Post #26:
http://www.gossamer-threads.com/...i?post=278709#278709

Is it possible, that tondelo did not try that code?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [tondelo] Alternating Row Color In reply to
Within Links SQL Help/Templates/Template Syntax page, the documentation explains the template "loop" feature, showing the "link_results_loop" usage in the example:
Quote:
Loops:
If you are feeling a bit overwhelmed, then you can skip this part. Loops are an advanced feature that provide complete control over the layout of the directory. Perhaps you don't like the fact that the same link.html template is used when displaying a list of search results and for displaying the links in the category page. Well, by default Links SQL only provides you with a <%link_results%> tag, so there is not much you can do, right? Wrong! For all of the major tags, you can use loops instead. Let's look at search results. Instead of:

<p>Here are your matching links:<br><br><%link_results%></p>

You could do:

<p>Here are your matching links:<br><br>
<%loop link_results_loop%>
<a href="<%URL%>"><%Title%></a>: <%Hits%>
<%endloop%>

So inside the <%loop%> and <%endloop%> tag you have a series of links, and you can use any link attribute you like. However, don't forget you can also use includes, so you could do:

<p>Here are your matching links:<br><br>
<%loop link_results_loop%>
<tr><td><%include link.html%></td></tr>
<%endloop%>

Now link.html will be loaded and parsed!


Now something is strange, as Andy says links_loop is working, and link_results_loop doesn't in category.html.

Finally I went into the templates and checked what is the truth about the loop variables.

The result of the loop investigation is the following:
  • On home.html following loops are available: category_loop
  • On category.html following loops are available: links_loop, category_loop, related_loop
  • On new.html following loops are available: link_results_loop, title_linked_loop, (and if you don't have span pages turned on, then the loop contains a list of dates with: new_date, links)
  • On new index page following loops are available: link_results_loop
  • On new subpage following loops are available: link_results_loop
  • On cool.html following loops are available: link_results_loop
  • On rate_top.html following loops are available: top_rated_loop, top_votes_loop
  • On review_search_results.html following loops are available: Review_Loop
  • On search_results.html following loops are available: link_results_loop, category_results_loop

    These informations are usually available in the header part of these templates.


    It seems, that GT did not follow the same loop naming scheme, so for home.html, category.html, review_search_results.html uses different loop naming scheme.

    Probably would be fine if GT would unify these naming schemes (while backward compatibility should be kept for next few versions...).
    Or at least a unified documentation, like the above one should be published.

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
  • Quote Reply
    Re: [webmaster33] Alternating Row Color In reply to
    In Reply To:
    Hmmm... This is the same code I suggested in my Post #26:
    http://www.gossamer-threads.com/...i?post=278709#278709

    Is it possible, that tondelo did not try that code?

    WM, you are correct, the only difference in the two is the width being set which has absolutely no bearing on the functionality of the snippit..

    The fact that I did try everyones suggestions has me puzzled as to why I couldn't get it working back on your #26 post.. I don't know if I put it in the wrong location or the wrong template but it was obviously somthing on my end..

    Thanks to everyone for the help on this and I can't wait to see the added tutorials in Links v3.x..
    Quote Reply
    Re: [tondelo] Alternating Row Color In reply to
    You are welcome!
    I'm glad, that finally works the way you wanted.

    Best regards,
    Webmaster33


    Paid Support
    from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
    Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
    > >