Gossamer Forum
Quote Reply
Alphabetical pages
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)?
Quote Reply
Re: [MJB] Alphabetical pages In reply to
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!
Quote Reply
Re: [Andy] Alphabetical pages In reply to
Sort of but site related not just category.

I want it to list just the title of the link but for the whole database regardless of what category a link is in.
Quote Reply
Re: [MJB] Alphabetical pages In reply to
Should be possible with a global like this:

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!

Last edited by:

Andy: Dec 3, 2009, 11:54 PM
Quote Reply
Re: [Andy] Alphabetical pages In reply to
Thanks sleepy head. I'll give that a try when I get a few mins. Smile

Last edited by:

MJB: Dec 3, 2009, 1:52 PM
Quote Reply
Re: [MJB] Alphabetical pages In reply to
Looks pretty good to me. All that was missing was a p

Quote:
Then call with page.cgi?p=get_links_by_letter;letter=A
Thanks again Andy. Smile
Quote Reply
Re: [MJB] Alphabetical pages In reply to
Oops, have updated my post above Smile

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!