[Catalyst] Alphabetical Paging based on First Letter
Ashley
apv at sedition.com
Thu Feb 28 00:01:57 GMT 2008
On Feb 27, 2008, at 3:50 PM, Matt Knesi wrote:
> I would like to implement a page navigation based on the first
> letter of the items, e.g. first letter of last names, so all last
> names with 'A' will display when you click on 'A' (instead of page
> 1) and all last names starting with 'M' appear when you click on
> 'M' and so on...
>
> Only the initials that are actually present in the database should
> be displayed for paging navigation, so if there is NO last name
> starting with 'X', 'X' shouldn't show up in the navigation line.
I've done this with a dictionary application. You could do a
relationship to a letter. So say name has_one letter, letter has_many
names. Or what I've done a couple of times is make "letter" a field
in the target table (word for me, name for you) and just keep the
letter or "#" for a leading number/special and make it an index so
it's fast to lookup.
-Ashley
More information about the Catalyst
mailing list