Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-07-10 07:54:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,539
Website GitHub

Re: smd_write_cats: create categories on the fly from the Write tab

monkeyninja wrote:

could have it work like Kermit<Muppets for child followed by parent or Muppets>Kermit

Hadn’t thought of that but Uli seems to want the parent at the ‘point’ end of the greater-then/less-than symbol so neither of the above will satisfy him :-)

I’ve implemented a pref for choosing the parent-child delimiter and also a pref for the order of items (child_first: 1 or 0).

Just running it through some rigorous tests as I don’t want to be responsible for corrupting someone’s category tree. Will try and release it later today / tonight.


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

Offline

#14 2010-07-11 12:58:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,539
Website GitHub

Re: smd_write_cats: create categories on the fly from the Write tab

After a slight delay, here’s v0.20. You should upgrade to this version immediately as v0.10 had some quirks that may cause problems in your category table (knew the plugin was too easy last time!)

Now:

  • Added parent->child creation
  • You can specify the parent-child delimiter via a hidden pref
  • You can switch the parent-child link order if you wish via a hidden pref
  • Only users with appropriate catgeory privs can add categories (thanks Uli)
  • Made internal tests case insensitive so you can’t create duplicates
  • Improved efficiency: fewer database calls and it’s still less than 100 lines of code
  • Prevented ‘root’ from being created/displayed
  • Set class of input box to Edit (thanks Uli)
  • Fixed stupid oversight with category types so they only consider articles (thanks monkeyninja/Uli)

Be aware that v0.10 will have erroneously created category names that are of mixed case. v0.20 forces lower case names (titles are unaffected). Now, when you type in ‘MY New CaTEGoRy’ the plugin uses that as your category title but ‘my-new-category’ as its name. I recommend you leave it this way and let the plugin assign lower case names on your behalf. It may be prudent to check your categories, especially those created by v0.10 and make them lower case.

Note that if you really want mixed case names you can use TXP’s interface to re-edit the names but I strongly advise against this: for starters you probably won’t be able to assign cats using this plugin because it won’t ‘find’ them. I consider the fact that categories can be altered to use mixed case a TXP bug, but I don’t know how everyone else feels about this or if there’s a good reason why it’s permitted.

Anyway, see how you get on with this version.


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

Offline

#15 2010-07-18 12:33:28

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,259

Re: smd_write_cats: create categories on the fly from the Write tab

Stef, many thanks for implementing the parent child order thing, and sorry for not responding earlier. I’d hoped to find time for in detail testing, but still couldn’t do so.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#16 2012-05-31 18:06:27

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: smd_write_cats: create categories on the fly from the Write tab

I’d love something like the for the Images tab and Image Categories.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#17 2012-05-31 19:25:48

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,539
Website GitHub

Re: smd_write_cats: create categories on the fly from the Write tab

MattD wrote:

I’d love something like the for the Images tab and Image Categories.

Hmmmm, no reason it couldn’t be extended I suppose. Let me sleep on it. Though the plugin name might need a rethink.


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

Offline

#18 2012-06-11 15:39:01

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: smd_write_cats: create categories on the fly from the Write tab

Stef, Is this an easy change to support images? I took a look at it but I couldn’t figure it out…


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#19 2012-06-12 10:09:05

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,539
Website GitHub

Re: smd_write_cats: create categories on the fly from the Write tab

MattD wrote:

Stef, Is this an easy change to support images?

Reasonably so. Please report if the beta v0.30 works ok for the other content types. The only reason it’s not official yet is because it only half works on the Write tab under SVN. Gotta talk to Robert about something first.


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

Offline

#20 2012-06-13 17:40:19

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: smd_write_cats: create categories on the fly from the Write tab

It doesn’t appear to be working for images. When I enter a new category and save the image the image shows in the list with the correct category but when I click edit again the category is blank and the new category does not exist in the dropdown or on the category tab.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#21 2012-06-13 19:51:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,539
Website GitHub

Re: smd_write_cats: create categories on the fly from the Write tab

MattD wrote:

It doesn’t appear to be working for images

D’oh! Missed the image_insert and file_insert hooks. Try re-downloading the beta and let me know if that’s any better. Sorry about that.


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

Offline

#22 2012-06-13 20:42:19

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: smd_write_cats: create categories on the fly from the Write tab

Category creating is working but I can’t seem to get it to create a child category, either using an existing parent or providing a new parent.

Even using the example Parent category -> New category results in the creationg of “new-category” under root.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#23 2012-06-13 22:24:49

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,539
Website GitHub

Re: smd_write_cats: create categories on the fly from the Write tab

MattD wrote:

Category creating is working but I can’t seem to get it to create a child category

Bah, third (4th?) time lucky. Try the latest beta download please.

Notes:

  • The Parent you specify must be the category Title not the Txp-sanitized (possibly hyphenated) name.
  • If you try to assign a child to a non-existent parent (i.e. you are trying to create both Parent -> Child in one step) then the child will be assigned to root.

I could probably find a way round it so it made both parent and child cats, but for now it’s a known limitation that I’ll document.

Last edited by Bloke (2012-06-13 22:25:40)


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

Offline

#24 2012-06-13 23:04:31

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: smd_write_cats: create categories on the fly from the Write tab

Looks like that did the trick. I’ll continue testing and update you if I hit an issue.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

Board footer

Powered by FluxBB