Is this possible? Can I set up an alphabetical hyperlink list so that when a user clicks on 'G' for example I will display a page that lists all links in alphabetical order that start with that letter on a separate page (or custom template)?
Dec 2, 2009, 10:35 AM
Veteran / Moderator (18436 posts)
Dec 2, 2009, 10:35 AM
Post #2 of 7
Views: 6468
Like this?
http://www.ultranerds.com/...ugins/AlphaBar_L170/
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!
http://www.ultranerds.com/...ugins/AlphaBar_L170/
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!
Dec 2, 2009, 11:12 PM
Veteran / Moderator (18436 posts)
Dec 2, 2009, 11:12 PM
Post #4 of 7
Views: 6413
Should be possible with a global like this:
get_links_by_letter
my $tbl = $DB->table('Links');
$tbl->select_options("ORDER BY Title");
my $letter = $IN->param('letter');
my $sth = $tbl->select( GT::SQL::Condition->new('isValidated','=',"Yes",'Title','LIKE',"$letter%") );
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
if ($CFG->{build_detailed}) { $hit->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $hit->{ID} ); }
if ($hit->{isNew} eq "Yes") { $hit->{isNew} = 1; } else { $hit->{isNew} = 0; }
if ($hit->{isPopular} eq "Yes") { $hit->{isPopular} = 1; } else { $hit->{isPopular} = 0; }
if ($hit->{isChanged} eq "Yes") { $hit->{isChanged} = 1; } else { $hit->{isChanged} = 0; }
push @loop, $hit;
}
return { links_loop => \@loop };
}
Then make a new template (called get_links_by_letter.html) ... and call that global with:
<%if links_loop.length%>
<ul>
<%loop links_loop%>
<li><%Title%></li>
<%endloop%>
</ul>
<%else%>
No matches
<%endif%>
Then call with page.cgi?p=get_links_by_letter;letter=A (that should get a list of all links where "Title" starts with "A" or "a")
Untested - and was written literally after getting out of bed - so could be some issues that may need fixing :)
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!
get_links_by_letter
Code:
sub { my $tbl = $DB->table('Links');
$tbl->select_options("ORDER BY Title");
my $letter = $IN->param('letter');
my $sth = $tbl->select( GT::SQL::Condition->new('isValidated','=',"Yes",'Title','LIKE',"$letter%") );
my @loop;
while (my $hit = $sth->fetchrow_hashref) {
if ($CFG->{build_detailed}) { $hit->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $hit->{ID} ); }
if ($hit->{isNew} eq "Yes") { $hit->{isNew} = 1; } else { $hit->{isNew} = 0; }
if ($hit->{isPopular} eq "Yes") { $hit->{isPopular} = 1; } else { $hit->{isPopular} = 0; }
if ($hit->{isChanged} eq "Yes") { $hit->{isChanged} = 1; } else { $hit->{isChanged} = 0; }
push @loop, $hit;
}
return { links_loop => \@loop };
}
Then make a new template (called get_links_by_letter.html) ... and call that global with:
Code:
<%get_links_by_letter%> <%if links_loop.length%>
<ul>
<%loop links_loop%>
<li><%Title%></li>
<%endloop%>
</ul>
<%else%>
No matches
<%endif%>
Then call with page.cgi?p=get_links_by_letter;letter=A (that should get a list of all links where "Title" starts with "A" or "a")
Untested - and was written literally after getting out of bed - so could be some issues that may need fixing :)
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!
Dec 3, 2009, 11:55 PM
Veteran / Moderator (18436 posts)
Dec 3, 2009, 11:55 PM
Post #7 of 7
Views: 6408
Oops, have updated my post above
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!

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!