Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
anyone working on a category plugin ?
A category plugin that can handle nested categories down to about 5-7 levels ? Not alphabetizing them, but in the sequence i set them to be in. of course, I presume others are looking for the same kind of plugin. Oh, and any page that uses it has to load quickly. Under 2 seconds.
About the only encouragement I can offer is to link to your website, if it doesn’t violate my web hosts terms of service.
Any one ?
Thank you.
Last edited by JimJoe (2010-02-15 16:23:19)
Offline
#2 2010-02-15 21:21:50
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: anyone working on a category plugin ?
Just curious: are you using a plugin right now to display the nested categorie list? Only asking because what I see on your site now can easily be done without a plugin. The sorting could be done by adding a number to the category names, if it doesn’t really matter to you what the URLs look like (/category/01-adventures, /category/02-ancient, etcetera).
I noticed a lot of your category names (i.e. the part that appears in the URL) have capitals. Section and category names should always be all lowercase. Looking at your number of categories, I hope someone will be able to show you a mysql query that can change them all at once ;)
Offline
Re: anyone working on a category plugin ?
I’m using stw_category_tree in the right sidebar. I am using rss_unlimited_categories to display a category cloud at the bottom of the page.
I have no problem adding numbers to the category names. Wouldn’t bother me at all.
I am a fairly fast typist… I can change them manually. I don’t think all of them are Upper case to start.
Without a plugin ? Okay, how ? I’m willing to listen. But hopefully I can add categories when I write an article. Pull down menu, selection list.. doesn’t matter, as long as I can do it, and not take lots of time to add the categories.
Thanks.
Offline
Re: anyone working on a category plugin ?
Oh, I finally understand what you mean about the mysql query. I would have to edit all of the urls, and the category names.
I looked at about 20 of the category names on the Admin category page, and some are lower case.
Offline
#5 2010-02-15 23:16:01
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: anyone working on a category plugin ?
JimJoe wrote:
I would have to edit all of the urls, and the category names.
The URLs are created dynamically, you don’t have to edit them unless you hardcoded them somewhere.
Okay, how ? I’m willing to listen.
This is 5 levels, it can be extended of course. Not tested, but I think it should work. The sorting is still alphabetical, but by adding numbers to your category names you can influence that (the same goes for the stw_category_tree plugin of course).
I’m curious if it changes anything about the site’s load time. I’ve been wondering if the capitals in category names could cause the slowness, but I doubt that.
<txp:category_list parent="" children="0" wraptag="ul" break="li" class="level1">
<txp:category title="1" link="1" />
<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="li" class="level2">
<txp:category title="1" link="1" />
<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="li" class="level3">
<txp:category title="1" link="1" />
<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="li" class="level4">
<txp:category title="1" link="1" />
<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="li" class="level5">
<txp:category title="1" link="1" />
</txp:category_list>
</txp:category_list>
</txp:category_list>
</txp:category_list>
</txp:category_list>
But hopefully I can add categories when I write an article.
Mmm… I’m afraid that’s not possible, you need to add the category before writing the article (or after saving it as draft, then after you have added the category you need to change it to live). Can the plugin do it?
Offline
Re: anyone working on a category plugin ?
Els wrote:
you need to add the category before writing the article
Yes, or use a (slightly quicker) cheat I stumbled upon the other day. If you find you need to add a category mid-article, pop open a new browser tab pointing at the Categories page, add your article category and save it, then flick back to your Write browser tab and switch the article’s mode from Text to Preview (or XHTML) and then back to Text. The article content is restored but, crucially, the page has been reloaded so your new category is now available in the list without having to save the article first.
It’s a kludge though, and I’d like to change this procedure in future TXP’s so you can add a category on-the-fly directly from the Write tab. Whether it’s possible remains to be seen.
Last edited by Bloke (2010-02-15 23:25:19)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
#7 2010-02-15 23:27:09
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: anyone working on a category plugin ?
Bloke wrote:
or use a (slightly quicker) cheat I stumbled upon the other day. If you find you need to add a category mid-article, pop open a new browser tab pointing at the Categories page, add your article category and save it, then flick back to your Write browser tab and switch the article’s mode from Text to Preview (or XHTML) and then back to Text. The article content is restored but, crucially, the page has been reloaded so your new category is now available in the list without having to save the article first.
Great find! I didn’t know that, thanks Stef :)
Offline
Re: anyone working on a category plugin ?
I haven’t hard coded the urls; however, I have some hard coded urls in various articles. It was my attempt to reduce the number of categories. I saw no reason to have a category for everything… I have a category for ‘journeys’ as various characters trek across the globe. I didn’t have sub-categories for every character going on a trek.
I am uncertain how renumbering would keep them nested…
Lets see crestar could become 1000crestar then adventures becomes 2000adventures, ancient woudl become 3000ancient. Would a child category under ancient then become 3001endage10 ?
I’ll try it and see.
Offline
Re: anyone working on a category plugin ?
I have only done a small part of renumbering the categories, gettig some odd results. I presume it will ‘straighten out’ after all are renumbered.
Some categories are repeating.
Offline
#10 2010-02-16 00:05:09
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: anyone working on a category plugin ?
JimJoe wrote:
Lets see crestar could become 1000crestar then adventures becomes 2000adventures, ancient woudl become 3000ancient. Would a child category under ancient then become 3001endage10 ?
Whatever works for you. You could do something like this:
- 10000
- 11000
- 12000
- 12100
- 12110
- 12111
- 12110
- 12100
- 13000
- 20000
- 21000
… you get the idea. In theory you could also start with 1 (or rather 01 since there’ll be more than 9 likely) for ever new level, because the sorting happens per level.
I am uncertain how renumbering would keep them nested…
As long as you assign them to the right parent, the numbering won’t influence that.
Offline
Re: anyone working on a category plugin ?
I should have them further apart than increments of 1, as you point out. I have to be at work before 5 AM local tomorrow, so I likely wont be able to complete this tonight. I’ll do more of them, and see what happens.
Thanks for your help.
Offline
Re: anyone working on a category plugin ?
The speed up is substantial.
Offline