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

Re: Adding a number in front links whne listing

Quote Reply
Re: Adding a number in front links whne listing In reply to
Let's not make this harder than it is. (first, lets get the right subroutine <G> )

We are looking at sub build_category_pages in nph_build.cgi where the links are built for the pages.

The logic is, to initialize the variable, then pass it as a value in each link JUST BEFORE it goes to the link template.

So, define

my $links_count = '0';

at the top of sub build_category_pages in nph_build.cgi.

Then, later down, where you see:

Code:
# If we are spanning pages, we grab the first x number of links and build
# the main index page. We set $numlinks to the remaining links, and we remove
# the links from the list.

initialize the variable. This is just before any of the loops, tests, and checks for links, but AFTER you know what category you are working in.

$links_count=0;


Then, in 3 places, you want to change:

Code:
$tmp = $LINKDB->array_to_hash (${$links_r}[$i]);
$OUT{links} .= &site_html_link ($tmp);

to

Code:
$tmp = $LINKDB->array_to_hash (${$links_r}[$i]);
$links_count= $links_count+1;
$tmp->{'links_count'}=$links_count;
$OUT{links} .= &site_html_link ($tmp);


This increments the link number FIRST, then assigns it to the temporary link hash, which is passed BY REFERENCE to the site_html_link building routine.

The tag <%links_count%> is now available in the link.html template.


BTW: if you want to see what it does:

www.postcards.com/DP_Test/pages/

This is my test site, so you never know what to expect, and it's often not pretty... but I added:

Code:
<P><FONT FACE=ARIAL SIZE=3><B>This is Link #<%links_count%></B></FONT></P>

to the link for testing purposes.



[This message has been edited by pugdog (edited April 12, 2000).]
Subject Author Views Date
Thread Adding a number in front links whne listing Ground Zero 10463 Apr 8, 2000, 6:37 PM
Post Re: Adding a number in front links whne listing
Ground Zero 10285 Apr 11, 2000, 6:33 AM
Post Re: Adding a number in front links whne listing
Alex 10230 Apr 11, 2000, 7:59 AM
Post Re: Adding a number in front links whne listing
pugdog 10263 Apr 11, 2000, 9:08 AM
Post Re: Adding a number in front links whne listing
pugdog 10228 Apr 11, 2000, 10:17 AM
Post Re: Adding a number in front links whne listing
Ground Zero 10221 Apr 11, 2000, 1:01 PM
Post Re: Adding a number in front links whne listing
pugdog 10230 Apr 11, 2000, 6:54 PM
Post Re: Adding a number in front links whne listing
pugdog 10235 Apr 11, 2000, 9:42 PM
Post Re: Adding a number in front links whne listing
Ground Zero 10226 Apr 12, 2000, 12:04 AM
Post Re: Adding a number in front links whne listing
Ground Zero 10223 Apr 13, 2000, 5:28 PM
Post Re: Adding a number in front links whne listing
pugdog 10248 Apr 13, 2000, 8:53 PM
Post Re: Adding a number in front links whne listing
pugdog 10278 Apr 13, 2000, 9:52 PM
Post Re: Adding a number in front links whne listing
pugdog 10286 Apr 13, 2000, 10:39 PM
Post Re: Adding a number in front links whne listing
Ground Zero 10225 Apr 14, 2000, 6:32 AM
Post Re: Adding a number in front links whne listing
Ground Zero 10220 Apr 14, 2000, 9:52 AM
Post Re: Adding a number in front links whne listing
Ground Zero 10277 Apr 14, 2000, 10:34 AM
Post Re: Adding a number in front links whne listing
pugdog 10230 Apr 14, 2000, 4:31 PM
Post Re: Adding a number in front links whne listing
Stealth 10220 Apr 15, 2000, 8:30 AM
Post Re: Adding a number in front links whne listing
pugdog 10257 Apr 15, 2000, 4:25 PM
Post Re: Adding a number in front links whne listing
Stealth 10229 Apr 15, 2000, 5:07 PM
Thread Re: Adding a number in front links whne listing
pugdog 10245 Apr 16, 2000, 11:45 PM
Thread Re: Adding a number in front links whne listing
jeffb 10251 Jul 24, 2000, 5:09 PM
Thread Re: Adding a number in front links whne listing
pugdog 10191 Jul 25, 2000, 12:22 AM
Thread Re: Adding a number in front links whne listing
jeffb 10190 Jul 25, 2000, 2:56 AM
Thread Re: Adding a number in front links whne listing
jeffb 10189 Jul 25, 2000, 5:24 AM
Post Re: Adding a number in front links whne listing
DogTags 1585 Aug 6, 2000, 9:50 AM