Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Re: [jdgamble] numbered search results: Edit Log

Here is the list of edits for this post
Re: [jdgamble] numbered search results
Maybe an another version, which can be used easier:

Code:
sub {
my $counting = shift || 1;
my $tags = GT::Template::tags();
my $page_num = 0;
my $page = $IN->param('g') || $ENV{PATH_INFO} || '';
$page =~ /more(\d+)/ && ($page_num = $1);
$page_num ||= $tags->{'nh'} || $IN->param('nh') || 1;
my $links_per_page = $tags->{'mh'} || $CFG->{'build_links_per_page'};
my $link_nr = ($page_num -1) * ($links_per_page) + $counting;
return $link_nr;
}

The global above can be named as "link_numbering" and used as <%link_numbering($counting)%> in link.html.
The advantage of this global, that it doesn't require to have <li>...</li> list in link.html, and does numbering without this.


In search_results.html replace
Code:
<%link_results%>
tag to
Code:
<%--link_results--%>

and use the following code after it:
Code:
<%loop link_results_loop%>
<%set counting += 1%>
<%include link.html%>
<%endloop%>


And in link.html add:
<%link_numbering($counting)%>


The global was tested under LSQL v2.1.2, in category.html, and worked fine in dynamic mode.
It was not tested in static mode, but I added support for it, so theoritically should work in static mode, too.

In search_results.html should also work correctly, as it is in dynamic mode.

Let me know how it worked.

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: Aug 16, 2005, 10:13 PM

Edit Log: