Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-25 14:56:29

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

parent in getTree()

Is there any reason why $parent is omitted from the output array of getTree()? I can see why it’s not needed in getTreePath() since that extracts the whole route so the hierarchy can probably be determined with a bit of logic, but I can’t fathom why it’s not in getTree(). People like me who love messing with hierarchy plugins would benefit imo; especially since ‘parent’ is already pulled out of the DB in the query.

One extra line would do the trick I think:

$out[] =
	array(
		'id' => $id,
		'name' => $name,
		'title' => $title,
		'level' => count($right),
		'parent' => $parent,     // <--- HELLO!
		'children' => ($rgt - $lft - 1) / 2
	);

If there’s no reason for its exclusion, would it be possible to add it? Or if there is a reason for its omission, perhaps someone could enlighten me on how I might find all parent nodes for a given subset of/all children. Many thanks in advance.

Last edited by Bloke (2008-06-25 14:58:10)


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-06-26 07:22:50

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: parent in getTree()

Will meditate about this later…

Offline

#3 2008-06-30 15:23:22

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: parent in getTree()

Offline

#4 2008-06-30 15:36:51

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

Re: parent in getTree()

Eeeeeexcellent.

Thank you.


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

Board footer

Powered by FluxBB