Gossamer Forum
Quote Reply
A-Z listing per category
Hi,

I want a A-Z listing per category. Can someone help me with that? I can't find a proper solution in the forums...

Thanks,
Ron
Quote Reply
Re: [rsahertian] A-Z listing per category In reply to
I'm confused. It should be done alphabetically anyway. I suppose what you could do is to remove the 'popular' and 'new' links ordering. Goto Setup > Build Options;

From:
build_sort_order_category => isNew DESC,isPopular DESC,Title

To:
build_sort_order_category => Title

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] A-Z listing per category In reply to
No sorry Andy, that;s not what I mean , I must be more descriptive..

Must be like:

a|b|c|d|e|f|g|h|i etc....

on top of every category.

Thanks,
RonBlushBlush
Quote Reply
Re: [rsahertian] A-Z listing per category In reply to
Hi Ron,

I haven't tested this but it is modified from the index that I am using for my whole site.

You need to add a new template called cat_index.html (just save category.html as cat_index.html). Call the global below index and then in your cat_index page you need to add <%index('$letter','$ID')%> somewhere above the place where you want the links displayed.

Then you need to make the alphabet bar using

<a href="<%db_cgi_url%>/page.cgi?p=cat_index&ID=<%ID%>&letter=A">A</a>

for each letter.

And where you want the links to be displayed use <%index%>.

I haven't included the page span in this as that becomes even more complicated so this will show all links starting with one letter on the same page. Hope it works.

Laura.

-------------------------------------

sub {
# -------------------------------------------------------------------
my ($output,$sth,$link);
my $letter = shift;

my $id = shift;
unless ($letter =~ /^.$/){return;}
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options ("ORDER BY Title ASC");
my $cond = GT::SQL::Condition->new('Title', 'LIKE', "$letter%", 'isValidated','=','Yes', 'CategoryID', '=', $id);
# Displays the links by letter.
$sth = $link_db->select ($cond);
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return {index=>$output};
}
Quote Reply
Re: [afinlr] A-Z listing per category In reply to
Thank you Laura, but before testing it, I would like to know if this also suitable for static pages??

Thanks,
Ron
Quote Reply
Re: [rsahertian] A-Z listing per category In reply to
Yes you can use this method with a static site - obviously these pages won't be static but all the links will still work to the rest of your site.

Ways to diplay these as 'static' pages (depends why you want them to be static):
  • You could add subcategories to all your categories containing the letters of the alphabet! (this would involve some changing of the way you display subcategories to stop it from displaying all these in your list of subcategories)
  • I assume that you could use Ivan's pagebuilder plugin but you'd need to ask him about that.
  • You could use rewrite rules to make them look like static pages.
  • Some sort of plugin with a pre hook to run before the site is built.


Someone else might have a better idea - I would just run these as dynamic pages within the static site.

Laura.
Quote Reply
Re: [afinlr] A-Z listing per category In reply to
Hi Laura,

Works!!!! thanks!!!!

There is only this message on the cat_index.html

No category_id tag found! This tag can only be used on category.html template.

Is this a minor problem??

Bye,
Ron
Quote Reply
Re: [rsahertian] A-Z listing per category In reply to
I'm not sure how it is working without the ID tag? Tongue

I assumed that you would just put the index bar at the top or bottom of your category pages so it would automatically get passed in. I think that you will need to feed it in when you link to the page from your category page:

<a href="<%db_cgi_url%>/page.cgi?p=cat_index&ID=<%ID%>">Index</a>

or straight onto letter A

<a href="<%db_cgi_url%>/page.cgi?p=cat_index&ID=<%ID%>&letter=A">A</a>
Quote Reply
Re: [afinlr] A-Z listing per category In reply to
Dear Laura,

I removed some specific category tags from the cat_index template that only may used on the category template.

Everything seems to be ok now.

I am gonna try to get this thing static with spanning pages!!

But for now I am very happy with this!!!

Thanks again,
Ron....

Last edited by:

rsahertian: May 26, 2003, 12:02 AM
Quote Reply
Re: [rsahertian] A-Z listing per category In reply to
Hi,

check out the alpha_bar plugin (somewhat old). It started out to do automatically what you are trying to do (including generating the alpha bar automataticly), and I actually never got around to it. Way back in the early days of HTML (about 1993) I had made an alpha bar, and had 27 pages (numbers), and it was just a mess to try to deal with. An automated solution was what I was shooting for. Never got there, quite <G>

What it _does_ do is allow searches by start of work ie: b, bl, blue, etc or in-string searches, such that the word contains a, ap, ape etc.

It plugs into the search system, but you can pre-define searches for an alphabet bar.

I think you can also pick the field you want it to search, as well.

I haven't looked at it in awhile, but I wrote it to allow people to search for domains, and I need to clean it up, since it's what I'll be using for searching for classifieds and auction items, as well as photos in the gallery.

If nothing else, it might help you work out some of the things you want to do.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.