EllisLab text mark
Advanced Search
1 of 3
1
   
Atozee Extension
Posted: 06 January 2007 01:03 PM   [ Ignore ]
Joined: 2005-01-05
115 posts

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: 815)
 Signature 

Celebrating again soon.

 
Posted: 06 January 2007 01:21 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-14
20504 posts

wiki’d twice. Thank you.

 
Posted: 06 January 2007 01:25 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2005-01-05
115 posts

haha, it’s beer not bear wink

 Signature 

Celebrating again soon.

 
Posted: 06 January 2007 01:36 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-14
20504 posts

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. =)

 
Posted: 06 January 2007 01:53 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2005-01-05
115 posts

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.

 
Posted: 06 January 2007 02:52 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2002-06-03
6434 posts

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.

 
Posted: 07 January 2007 12:08 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2004-07-22
149 posts

How about

UPDATE exp_weblog_titles SET title_alpha LEFT(title1); 

?

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

 Signature 

ExpressionEngineer - custom solutions for EE

I EE

 
Posted: 07 January 2007 12:40 PM   [ Ignore ]   [ # 7 ]   [ Rating: 0 ]
Joined: 2005-01-05
115 posts

Thanks Andy, and Derek for your suggestions.

 Signature 

Celebrating again soon.

 
Posted: 07 January 2007 06:20 PM   [ Ignore ]   [ # 8 ]   [ Rating: 0 ]
Avatar
Joined: 2006-07-21
61 posts

Could you localize it for UK = atozed ?  wink

 Signature 

// matthanson.net
// twitter

 
Posted: 07 January 2007 06:23 PM   [ Ignore ]   [ # 9 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-15
29075 posts

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

 
Posted: 08 January 2007 06:01 AM   [ Ignore ]   [ # 10 ]   [ Rating: 0 ]
Joined: 2005-01-05
115 posts

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

 Signature 

Celebrating again soon.

 
Posted: 08 January 2007 07:01 AM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-15
29075 posts

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

 
Posted: 08 January 2007 07:17 AM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Avatar
Joined: 2004-07-22
149 posts

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

 
Posted: 08 January 2007 07:55 AM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Joined: 2005-01-05
115 posts

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.

 
Posted: 11 January 2007 05:51 PM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-17
168 posts

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”?

 
Posted: 15 January 2007 03:08 PM   [ Ignore ]   [ # 15 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-17
168 posts

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

 
1 of 3
1