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

Question - Can the system tell if its the Last Link

Quote Reply
Question - Can the system tell if its the Last Link
Hello,

I want to set up the template so that if it is the last link in that category or the last link of 25, or whatever, I want to place some sort of code that says:

<%if last_link%>
code
<%endif%>

See I'm using a header at the top of the links listings, and a <HR> to seperate each link. I want to use this statement to put no <HR> if its the last link, and I want to repeat the header when the system says its the last link.

Any ideas?

------------------
James L. Murray
PaintballCity.com
The Yahoo of Paintball
www.paintballcity.com
AIM: Paintball City
ICQ: 44147229





Quote Reply
Re: Question - Can the system tell if its the Last Link In reply to
How about making it simple:

<%if links%>
<%links%>
header
<%endif%>

That ought to print the header after all the link results and only print the header if there actually are link results.

Dan
Quote Reply
Re: Question - Can the system tell if its the Last Link In reply to
Hello Dan,

Your right the header is no problem. Were the problem lies is that in the template link.html each link ends with an <HR> tag to seperate the links.

The last link on the screen will end in and <HR>. I want the system to eliminate the last <HR> if it is the last link.


------------------
James L. Murray
PaintballCity.com
The Yahoo of Paintball
www.paintballcity.com
AIM: Paintball City
ICQ: 44147229





Quote Reply
Re: Question - Can the system tell if its the Last Link In reply to
Would it be a problem if the list began with an <HR> before the first link? If so, place the <HR> before the link info in link.html. That's the technique I use to get the desired spacing around categories, links, and such.

If that doesn't work for you, I'm guessing it will take some nph-build.cgi code hacking...

Dan
Quote Reply
Re: Question - Can the system tell if its the Last Link In reply to
I know what you are trying to do, but it's a logic problem. This is not something the "template" can handle.

You need to hack the print_cat subroutine, where you insert the<HR>.

Don't insert one on the first link, maybe even special case the first link. Then insert the <HR> in the OPENING tags for the link before it's gone and gotten.

When the last link is found, you won't go back through the 'while' loop, so you won't get the final <HR>

Make sense?