Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [kjetilpalm] Link to record starting with...

Quote Reply
Re: [kjetilpalm] Link to record starting with... In reply to
Hi,

Follow the following steps:

1. In template global, add the sub-routine:

sub letter_search{
#-----------------------------------------------
#
my $tags = shift;
my $letter = $tags->{letter};
my $sql = $tags->{home}->{sql};
my $db = $tags->{db};
my $table = $sql->table($db);
my $sth = $table->select ( GT::SQL::Condition->new ('Column', 'LIKE', "$letter%"));
my @output;
while (my $hash = $sth->fetchrow_hashref ) {
push @output, $hash;
}
return { letter_loop => \@output };
}

2. in search_results.html, add some scripts:
.....
<%if letter%>
<%letter_search%>
<%loop letter_loop%>
<p><%Dbsql::HTML::generate_search_results%>
<%endloop%>
<%else%>
<%loop results%>
................
<%endloop%>
<%endif%>

3. create a link:
<a href=db.cgi?db=<%db%>&do=search_results......&letter=A>A</a>

Cheers,
TheStone


B.

Last edited by:

TheStone: Oct 17, 2001, 2:15 PM
Subject Author Views Date
Thread Link to record starting with... kjetilpalm 12741 Oct 17, 2001, 10:02 AM
Thread Re: [kjetilpalm] Link to record starting with...
604 12490 Oct 17, 2001, 1:41 PM
Thread Re: [TheStone] Link to record starting with...
jiliu 12460 Dec 25, 2001, 11:42 AM
Thread Re: [jiliu] Link to record starting with...
604 12481 Dec 26, 2001, 9:50 AM
Thread Re: [TheStone] Link to record starting with...
jiliu 12488 Dec 26, 2001, 6:02 PM
Thread Re: [jiliu] Link to record starting with...
jiliu 12438 Dec 31, 2001, 10:12 AM
Thread Re: [jiliu] Link to record starting with...
604 12445 Dec 31, 2001, 10:57 AM
Thread Re: [TheStone] Link to record starting with...
jiliu 12437 Jan 11, 2002, 9:25 AM
Post Re: [jiliu] Link to record starting with...
604 12427 Jan 11, 2002, 9:40 AM
Thread Re: [jiliu] Link to record starting with...
604 12421 Jan 11, 2002, 12:16 PM
Thread Re: [TheStone] Link to record starting with...
jiliu 12441 Jan 11, 2002, 12:55 PM
Thread Re: [jiliu] Link to record starting with...
604 12453 Jan 11, 2002, 1:42 PM
Thread Re: [TheStone] Link to record starting with...
jiliu 12368 Jan 12, 2002, 2:17 PM
Thread Re: [jiliu] Link to record starting with...
604 12387 Jan 14, 2002, 8:58 AM
Thread Re: [TheStone] Link to record starting with...
jiliu 12391 Jan 14, 2002, 10:48 AM
Thread Re: [jiliu] Link to record starting with...
jiliu 12263 Apr 19, 2002, 11:55 AM
Thread Re: [jiliu] Link to record starting with...
604 12216 Apr 19, 2002, 2:08 PM
Thread Re: [TheStone] Link to record starting with...
jiliu 12242 Apr 20, 2002, 8:46 PM
Thread Re: [jiliu] Link to record starting with...
604 12184 Apr 22, 2002, 9:10 AM
Post Post deleted by jiliu
jiliu 12188 Apr 22, 2002, 9:37 AM
Post Re: [TheStone] Link to record starting with...
jiliu 12192 Apr 22, 2002, 10:14 AM
Thread Re: [TheStone] Link to record starting with...
gatman 11914 Feb 23, 2003, 5:32 AM
Thread Re: [gatman] Link to record starting with...
ManuGermany 11931 Feb 23, 2003, 12:22 PM
Post Re: [ManuGermany] Link to record starting with...
gatman 11868 Feb 23, 2003, 1:14 PM