1 of 2
1
Atozee Extension
Posted: 06 January 2007 10:03 AM   [ Ignore ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

I just knocked up a quick extension to make it easier to create A to Z indexes of entries.

It creates a new column in exp_weblog_titles and adds the first character of the entry’s title.

You get a new parameter “title_alpha” to add to your exp:weblog:entries tag.  Example:

{exp:weblog:entries weblog="showcase|blog|features" title_alpha="{segment_3}" dynamic="off"}

or

{exp:weblog:entries weblog="showcase|blog|features" title_alpha="a|b|c" dynamic="off"}

You can see it in action here.  Just change the third segment to a letter to filter.  There’s no support for foreign characters.

I’ve tested it on a couple of sites without problems but don’t try it on anything critical until I’ve gained some feedback.

Any suggestions for improvement?

File Attachments
ext.atozee.zip  (File Size: 2KB - Downloads: 324)
 Signature 

Celebrating again soon.

Profile
 
 
Posted: 06 January 2007 10:21 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32775
Joined  05-14-2004

wiki’d twice. Thank you.

 Signature 
Profile
MSG
 
 
Posted: 06 January 2007 10:25 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

haha, it’s beer not bear wink

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 06 January 2007 10:36 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32775
Joined  05-14-2004

I totally knew that.  I blame misplacing beer with bear on WoW. *whistles*

This is why other people should be adding to the wiki.  See? Oooh. =)

 Signature 
Profile
MSG
 
 
Posted: 06 January 2007 10:53 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

You’re just too quick for us Lisa wink

BTW, the only reason I say don’t try it on critical stuff now is that when the extension is enabled it runs through all your entries and adds the first character to the title_alpha column.  I could probably improve the performance of this query as I’m not sure how it’ll handle sites with 1000s of existing entries.

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 06 January 2007 11:52 AM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15743
Joined  06-03-2002

I would probably prefix the new column name.  It’s not likely that we will add a column with that name, but by prefixing it with some something short and unique, you can be more assured that you are protected against potential collision, not only with first party changes, but with other third party add-ons a user might be using.  And yes, one query per entry, all at once, is probably not the best implementation.  As a matter of fact, I believe that you could do this with a single query, using MySQL’s built in string functions.

 Signature 
Profile
MSG
 
 
Posted: 07 January 2007 09:08 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  569
Joined  07-22-2004

How about

UPDATE exp_weblog_titles SET title_alpha = LEFT(title, 1);


?

Edit: I’d probably add either LOWER() or UPPER() to enforce one character case..

 Signature 

ExpressionEngineer - custom solutions for EE

I EE

Profile
 
 
Posted: 07 January 2007 09:40 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

Thanks Andy, and Derek for your suggestions.

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 07 January 2007 03:20 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  144
Joined  07-21-2006

Could you localize it for UK = atozed ?  wink

 Signature 

// matthanson.net
// twitter

Profile
 
 
Posted: 07 January 2007 03:23 PM   [ Ignore ]   [ # 9 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15167
Joined  05-15-2004

The only international way would be a2z, where pronounciation is left as an excercise to the reader grin

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 08 January 2007 03:01 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

come on people, it took me close to 2 minutes to think of a name with ‘ee’ in there.

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 08 January 2007 04:01 AM   [ Ignore ]   [ # 11 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15167
Joined  05-15-2004

Wow, I totally failed to realise/appreciate that… Well done, in this case.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 08 January 2007 04:17 AM   [ Ignore ]   [ # 12 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  569
Joined  07-22-2004

Hm.. come to think of it, I probably wouldn’t create another column unless its really neccessary for performance.
I’ll have to extend Derek’s line of though here, it’s potentially hasardous to alter the core tables, compared to adding a cpu-cycle and a half to each query.

SELECT entry_id FROM exp_weblog_titles WHERE LEFT(LOWER(title), 1) = 'a';

What are your thoughts on this?

 Signature 

ExpressionEngineer - custom solutions for EE

I EE

Profile
 
 
Posted: 08 January 2007 04:55 AM   [ Ignore ]   [ # 13 ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

Andy I think that’s a much better idea.  Unless anyone suggests otherwise in the meantime I’ll update the extension later today.

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 11 January 2007 02:51 PM   [ Ignore ]   [ # 14 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  402
Joined  03-17-2006

smallbeer, Is the currently linked extension the updated version?

edit: Also does dynamic have to be set to “off” or am I able to use this in conjunction with pagination which seems to require dynamic to be set to “on”?

Profile
 
 
Posted: 15 January 2007 12:08 PM   [ Ignore ]   [ # 15 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  402
Joined  03-17-2006

Anybody know if the linked extension is the current version? I’m having trouble getting it to work.

Profile
 
 
Posted: 15 January 2007 12:59 PM   [ Ignore ]   [ # 16 ]  
Research Assistant
RankRankRank
Total Posts:  547
Joined  01-05-2005

No the attached file isn’t the updated version.  I’ve been too busy the past few days.  It won’t take long though so I’ll try find the time tomorrow.

And no, the dynamic parameter doesn’t necessarily have to be set to ‘off’.

 Signature 

Celebrating again soon.

Profile
 
 
Posted: 16 January 2007 08:30 AM   [ Ignore ]   [ # 17 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  402
Joined  03-17-2006
smallbeer - 15 January 2007 12:59 PM

No the attached file isn’t the updated version.  I’ve been too busy the past few days.  It won’t take long though so I’ll try find the time tomorrow.

Ok, that could explain why I’m having trouble getting it to work. I’m looking forward to the updated version. smile

smallbeer - 15 January 2007 12:59 PM

And no, the dynamic parameter doesn’t necessarily have to be set to ‘off’.

Good to know, thanks.

Profile
 
 
Posted: 04 February 2007 06:06 AM   [ Ignore ]   [ # 18 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12273
Joined  04-29-2002

Gentle reminder, the file attached to this message has not been updated. It’s still dated January 6th.

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64546 Total Logged-in Users: 15
Total Topics: 81138 Total Anonymous Users: 12
Total Replies: 436518 Total Guests: 153
Total Posts: 517656    
Members ( View Memberlist )
Active Members:    CarlocschlormanDave_HharsingIngmar GreiljoemoJohnDLyle AndersonnoregtStephanytarowantosz25TwoMenDesignwizs