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).]