Gossamer Forum
Quote Reply
numbered search results
For anyone who wants to number their search results I wrote this mod a while back and figured I would document it:

In search_results.html add this <ol start=<%start%>><%link_results%></ol>
Make sure you link.html has <li> (refer to the previous post to get that done!)

and add this sub routine:

Code:

'start' => 'sub {
my $in = shift;
my $nh = $in->{nh};
my $mh = $in->{mh};
$nh = $nh * $mh - $mh;
$nh++;
return $nh;
}',


yeah... (I originally got the idea from lycos a few years ago)

Here is an example: http://www.magicdirectory.com/...i?query=david+blaine (this example probably won't exist too much longer)

Hope this entertains someone,

- Jonathan
Quote Reply
Re: [jdgamble] numbered search results In reply to
Thanks. I've added this global to SQLWidgets.com :)

http://www.sqlwidgets.com/...ces/Detailed/14.html

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] numbered search results In reply to
Wow! You sure added that fast! (then again who on this forum is actually keeping track of time)...

- Jonathan
Quote Reply
Re: [jdgamble] numbered search results In reply to
Cool
Quote Reply
Re: [Andy] numbered search results In reply to
can this be use for myfav plugin
Quote Reply
Re: [ajiimd] numbered search results In reply to
Do you mean a numbered list, next to their fave listings? If so, I'll try and add it tomorrow... but no guarantee's, as pugdogs MyFavLinks has pretty much made my version obsolite (although my version is still pretty widely used).

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] numbered search results In reply to
what is different in pugdogs version
Quote Reply
Re: [Andy] numbered search results In reply to
In some cases, there will be mistakes... here is a fix...

Code:

sub {
my $in = shift;
my $nh = $in->{nh} || 1;
my $mh = $in->{mh};
$nh = $nh * $mh - $mh;
$nh++;
return $nh;
}


Hope this helps some people...

- Jonathan
Quote Reply
Re: [jdgamble] numbered search results In reply to
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