Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-16 22:43:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

smd_parent: grab parents up the tree from any category

After a discussion on parent categories the consensus was there was no easy way to get a parent from the current category. A short while later there was :-)

smd_parent takes the exact same attributes as <txp:category /> with a couple of extra options to allow you to grab any level parent category from the tree instead. Works with all category types; image, article, link… the plugin help has some tables to explain how it works.

Revision history
————————

All available versions and changes are listed here. Each entry indexes the relevant post(s) in this thread to learn about the features.

  • 15 Jan 08 | v0.1 | Initial release

Last edited by Bloke (2009-04-11 21:13:20)


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

#2 2008-01-17 00:40:20

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 453
Website

Re: smd_parent: grab parents up the tree from any category

Thanks, Stef. Am using it with much gratitude! :-)


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#3 2008-01-17 01:02:00

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 453
Website

Re: smd_parent: grab parents up the tree from any category

Just had another look at your expanded help file in smd_parent.

Wow, I only now realize the full potential of this plugin. It is even more useful and powerful than I first imagined.

As your help file shows, you could make very extensive databases showing the full taxonomy (how an entry relates to the category tree) of each item. For example, you can now use Textpattern to make a database of animals, and for each animal show its full (linked!) Linnaean taxonomy in the individual article.

Just imagine the possibilities for scientific or commercial sites. Especially highly organized catalogues of items or products.

You have just pushed Textpattern a few steps up the ladder.

Sweet. Really sweet!

Last edited by Kjeld (2008-01-17 01:04:16)


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#4 2008-01-17 17:29:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: smd_parent: grab parents up the tree from any category

*grin* thanks Kjeld, really glad it’s useful for you.

You know what was crazy: the initial hunk of code was a rip of the attribute-handling and error-checking code from <txp:category /> and the cat1/2 derivatives in the core.

Without that, handling the two extra options was about 8-10 lines of code; the rest of the functionality I palmed off to txp:category. So for a mod to the core it’d be about that sort of magnitude (maybe less) to add a parentlevel attribute do the same thing in each of the built-in category functions.

Perhaps I should find out how to submit this as a patch instead of a plugin?!


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

#5 2008-01-17 19:47:14

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: smd_parent: grab parents up the tree from any category

Bloke wrote:

Perhaps I should find out how to submit this as a patch instead of a plugin?!

Yes!

Offline

#6 2008-04-28 09:44:16

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: smd_parent: grab parents up the tree from any category

Very useful to be able to be able to associate a product to a brand (the latter being the parent).

Bloke, the link to the plugin isn’t working.

Anyone else have it handy?

Thanks!

Loz

Offline

#7 2008-04-28 10:01:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: smd_parent: grab parents up the tree from any category

lozmatic wrote:

Bloke, the link to the plugin isn’t working.

Works for me now, but I’ve noticed my hoster’s having a go-slow today. Sorry for any inconvenience.

Last edited by Bloke (2008-04-28 10:01:29)


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

#8 2008-04-28 10:20:11

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: smd_parent: grab parents up the tree from any category

I’m still getting an error. I’ll try later from home – thanks

Offline

#9 2008-04-28 10:30:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: smd_parent: grab parents up the tree from any category

lozmatic wrote:

I’m still getting an error. I’ll try later from home – thanks

Curious. What error are you getting?

How about from pastebin ? (I’ve set it to expire today so be quick!)


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

#10 2008-04-28 12:04:29

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: smd_parent: grab parents up the tree from any category

pastebin.com returns a big fat ‘The Site requested is deemed to violate the Internet Security policy’. If I never post again it means the IT police here at work will have arrested me.

No worries – I’ll try from home later today.

Thanks for your help.

Offline

#11 2008-04-28 12:19:50

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,445
Website GitHub

Re: smd_parent: grab parents up the tree from any category

lozmatic wrote:

pastebin.com returns a big fat ‘The Site requested is deemed to violate the Internet Security policy’. If I never post again it means the IT police here at work will have arrested me.

lol, off-topic but I’ve been behind one of those corporate firewalls myself. Amazing how much legitimate and useful stuff like pastebin they block trying to force people to stay focused which, in reality, does the opposite as people try to find ways round it (I can understand my site being off limits but pastebin is potentially useful in a business environment!)

I remember having my own proxy server running at home so any site that stopped us with the big fat “You are in violation of Corporate Instruction 75” guard dog, we could re-route.

btw, if they get you, I’ll vouch for your integrity :-)


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

#12 2008-04-28 14:17:45

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: smd_parent: grab parents up the tree from any category

“You honour, Mr. Lozmatic didn’t actually want to grab his parents from up the tree… “

Offline

Board footer

Powered by FluxBB