Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

How to group Categories and Links Alphabetically?

Quote Reply
How to group Categories and Links Alphabetically?
1.How to create categories and links list like the one below?


A K O
Alabama Kansas Ohio
Alaska Kentucky Oklahoma
... ....

B ....
British Columbia
...
C
California
Colorado

D
...
E
...




2.Is it possible to start every column from a new letter but still keep somewhat equal length of columns, not having a part of the same letter links/categories in one column and other part in next column?


Not like this:
... Connecticut
C
California D
Colorado Delaware




3. Is it possible to create this type of list by using "where" statement but still nicely split the list in multiple columns (for example only show the list of categories where Location_Type eq "County")? I only know how to use where statement after running the loop, but this way for column splitting calculation the script takes total number of categories not the number of items with "where" filter.

Many thanks in advance!
Quote Reply
Re: [AMIXIMA] How to group Categories and Links Alphabetically? In reply to
Hi,

1) Not sure what you mean?

2) You are asking if its possible to put them in columns, like:

Quote:
A B C D E F G H I .... etc
A B C D E F G H I .... etc
A B C D E F G H I .... etc

3) Mmm,. not easily

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 (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] How to group Categories and Links Alphabetically? In reply to
Sorry for the confusion.

The formatting of my example was all gone in my post. See following urls for reference:

http://www.countries-ofthe-world.com/all-countries.html
http://www.countries-ofthe-world.com/...tries-of-europe.html

Thanks.
Quote Reply
Re: [AMIXIMA] How to group Categories and Links Alphabetically? In reply to
Ah ok, so you want to sort them into multiple columns, and have them "headed" using the start letter of them? What are you currently using for your templates to show the categories? It could probably be done using just some clever template work, but it may be more effecient to do as a global (going through the category loop, and setting a "show_letter" flag for the first instances of each charachter... you could then do some stuff in the template to show that header only for the first instance of that start charachter.

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 (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] How to group Categories and Links Alphabetically? In reply to
1. I use standard CSS file to format the categories in 3 columns.


2. How to find the first instance of each character without using globals?


3. And what about this:
Is it possible to start every column from a new letter but still keep somewhat equal length of columns, not having a part of the same letter links/categories in one column and other part in next column?
See again the example all columns start with a letter. I am not so sure this can be done with template alone.


4. What about splitting the links in the same manner, do you think it is possible?




Quote Reply
Re: [AMIXIMA] How to group Categories and Links Alphabetically? In reply to
Doing it with a template would be quite complex... you would need to do stuff like:

Code:
<%loop category_loop%>
<%if Name istart "a" or Name istart "A"%>
<%if not a_show%>
SHOW A
<%set a_show = 1%> <%-- do this so we know we have already show this letter... --%>
<%endif%>
<%elsif Name istart "b" or Name istart "B"%>
<%if not b_show%>
SHOW B
<%set b_show = 1%> <%-- do this so we know we have already show this letter... --%>
<%endif%>
<%elsif Name istart "c" or Name istart "C"%>
<%if not c_show%>
SHOW C
<%set b_show = 1%> <%-- do this so we know we have already show this letter... --%>
<%endif%>
...etc
<%endif%>

<%include subcategory.html%>
<%endloop%>

(obviously you would need to do that all the way through from A-Z... I just did a-c as an example)

Quote:
3. And what about this:
Is it possible to start every column from a new letter but still keep somewhat equal length of columns, not having a part of the same letter links/categories in one column and other part in next column?
See again the example all columns start with a letter. I am not so sure this can be done with template alone.

If you are using the standard GLinks luna templates, that should already happen (it uses "split" to work out the number of records needed per column, and then "closes" the column and starts a new one when it needs to)

Quote:
4. What about splitting the links in the same manner, do you think it is possible?

Anything is possible ;) In terms of splitting them into colums that shouldn't be too hard (but you would probably want to use <div's to float "left" and then when you get to the total number of links / number of columns, you would move onto the next column.

I'm afraid I'm really busy atm, so can't really spend any more time coming up with examples/testing anything. Sorry about that.

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 (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates