Quantcast

Filtering MM tree by tag

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Filtering MM tree by tag

McBride, Ian S.
Just wondering if there's a function in the MM or rss_page modules that returns an array or feed of all the items within a certain part of the MM tree that have a particular tag. I'll hunt around a bit and experiment setting something up with Views, but this seems like a fair common use case so I was wondering if it'd already been solved.

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=452601
or send a blank email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Filtering MM tree by tag

Dan Wilga-2
At 1:38 PM -0400 8/19/09, McBride, Ian wrote:
>Just wondering if there's a function in the MM or rss_page modules
>that returns an array or feed of all the items within a certain part
>of the MM tree that have a particular tag. I'll hunt around a bit
>and experiment setting something up with Views, but this seems like
>a fair common use case so I was wondering if it'd already been
>solved.

rss_page does it globally, not for a particular part of the site.
This uses the function mm_taxonomy_select_nodes(), our own version of
taxonomy_select_nodes(), found in mm_taxonomy.inc. Note: the $tids
parameter is NOT for mmtids; it's for taxonomy term IDs.

It would be fairly easily modified to accept an optional mmtid
parameter. If supplied, the function would only return nodes whose
mmtid, parent or "parents" contains that number; the latter part
would be the slowest in SQL:

...WHERE mm_tree.mmtid = %d OR mm_tree.parent = %d OR mm_tree.parents
REGEXP '[[:<:]]%d[[:>:]]'

I'm actually considering breaking out the parents (and flags) fields
of mm_tree into separate tables, to make queries like this much more
efficient. But that will probably have to wait for a major code
update.
--
Dan Wilga                                 [hidden email]
Web System Administrator/Programmer             http://www.amherst.edu
Amherst College                                      Tel: 413-542-2175
Amherst, MA  01002

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=452627
or send a blank email to [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Filtering MM tree by tag

McBride, Ian S.
In reply to this post by McBride, Ian S.
Thanks for this advice. I rolled up a quick patch that does this without affecting the queries that build the temporary tables.

-----Original Message-----
From: Dan Wilga [mailto:[hidden email]]
Sent: Wednesday, August 19, 2009 2:55 PM
To: Monster Menus Development
Subject: Re: Filtering MM tree by tag

At 1:38 PM -0400 8/19/09, McBride, Ian wrote:
>Just wondering if there's a function in the MM or rss_page modules
>that returns an array or feed of all the items within a certain part
>of the MM tree that have a particular tag. I'll hunt around a bit
>and experiment setting something up with Views, but this seems like
>a fair common use case so I was wondering if it'd already been
>solved.

rss_page does it globally, not for a particular part of the site.
This uses the function mm_taxonomy_select_nodes(), our own version of
taxonomy_select_nodes(), found in mm_taxonomy.inc. Note: the $tids
parameter is NOT for mmtids; it's for taxonomy term IDs.

It would be fairly easily modified to accept an optional mmtid
parameter. If supplied, the function would only return nodes whose
mmtid, parent or "parents" contains that number; the latter part
would be the slowest in SQL:

...WHERE mm_tree.mmtid = %d OR mm_tree.parent = %d OR mm_tree.parents
REGEXP '[[:<:]]%d[[:>:]]'

I'm actually considering breaking out the parents (and flags) fields
of mm_tree into separate tables, to make queries like this much more
efficient. But that will probably have to wait for a major code
update.
--
Dan Wilga                                 [hidden email]
Web System Administrator/Programmer             http://www.amherst.edu
Amherst College                                      Tel: 413-542-2175
Amherst, MA  01002

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685439.7e7cbccf9bb225cf8471bffe1cb67503&n=T&l=monster_menus&o=452627
or send a blank email to [hidden email]

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=452930
or send a blank email to [hidden email]

monster_menus.20090820.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Filtering MM tree by tag

Dan Wilga-2
In reply to this post by McBride, Ian S.
Looks good, Ian. It's in r3227, with minor cleanup. See also the
following message.
--
Dan Wilga                                 [hidden email]
Web System Administrator/Programmer             http://www.amherst.edu
Amherst College                                      Tel: 413-542-2175
Amherst, MA  01002

---
You are currently subscribed to monster_menus as: [hidden email].
To unsubscribe click here: http://lists.middlebury.edu/u?id=685503.6b071f880fe6a965a128164e6d09ea81&n=T&l=monster_menus&o=452972
or send a blank email to [hidden email]
Loading...