Taxonomy:

Subdivision 1
--Council District 1 (*)
--Fire District 2
--Legislative District 3
Subdivision 2
--Council District 1 (*)
--Fire District 4
--Legislative District 9

(*) This term has multiple parents

I have built a treemenu on the above and have tagged a node with "Council District 1". If I click on a parent term (e.g. "Subdivision 1"), I would like to see all the posts for the parent's descendant terms (e.g. "Council District 1", "Fire District 2", etc.). Clicking the parent in current code results in "There are currently no posts for this category".

I realize that this may be a function of taxonomy.module rather than of treemenu. If so, please point me, if possible, to where in taxonomy.module this could be hacked. Or if this could be accomplished via Views, some pointers on how to do so would be appreciated. TIA

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rcrowther’s picture

Assigned: Unassigned » rcrowther

Going to look at this. Can't promise a quick fix.

BayouBill’s picture

[Shameless brown nose alert!]

Thanks. Taxonomy_menu works this way but I like your module better!

(Does that move me up on the queue?)

<g>

rcrowther’s picture

I'm laughing! Errr - look, it seems reasonable, but in this module I've been tackling the things nobody else wants to take on...

(still laughing!) I really admire the Taxonomy Menu folks, because they were doing that too, but look at their issue queue - they get it in the neck all the time because they finessed to links only. And I got multi-dimentioned grumbling about how this thing wouldn't work... and that bit was bust and ...aw heck.

Sure, I'll look it over pretty quickly. I just suspect I need some look up some APIs and stuff, so it will take time to code.

[irrelevant partiality alert!] We're big fans of Creedence, the Allmans and Dr. John over here so, anyhow, your tag name will probably do the trick!

rcrowther’s picture

Hey you didn't say that this is a Taxonomy Menu special option! Well, I guess why would you see it from that point of view. The implementation seems clearer to me now, though.

BayouBill’s picture

"Hey you didn't say that this is a Taxonomy Menu special option!"

Is GPL great, or what?

rcrowther’s picture

If you happen to drop by, I've started working on this one. But it needs a new version, as I have to extend the database.

BayouBill’s picture

"I've started working on this one."

As Dr. John might say, "I'm just a lucky so-and-so"!

I'm subscribed, and I'm happy to test when code is available. Thanks for being so responsive.

rcrowther’s picture

Ok, try V6.0

Limitations
- no Views integration, conventional term pages only.
- doesn't respect the tid+tid/ tid, tid convention, always does an 'OR' search

Good bits
- stock Drupal. No bodge at all (try it - write your own URL in)
- works on stock or extended URLs

Was this what you were thinking on?

BayouBill’s picture

[Applicable Dr. John song: "Such a Night"]

I had already disabled and uninstalled the module so as not to interfere with other stuff I was testing, so I deleted the module folder and uploaded the 6.0 version. Then I ran update.php, which did nothing (I guess because I had uninstalled the module prior to that). Then I enabled the module, got no errors then, but got the following when trying to create a menu (and trying to go to the menu results in a Drupal "Page not found"):

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0,3,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1'a:3:{s:4:\"sort\";a:7:{s:5:\"title\";a:3:{s:6:' at line 9 query: INSERT INTO taxonomy_treemenu ( menu_name, depth, vid, tid, type, nodes, node_count, dhtml_blocks, dhtml_pages, prefix_urls, menu_urls, multiple_breadcrumbs, term_as_links, show_term_descendants, hide_empty_links, use_menu_breadcrumb, url_append_title, link_roots, options) VALUES ('menu-ttm-neighborhoodnotices'0,3,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1'a:3:{s:4:\"sort\";a:7:{s:5:\"title\";a:3:{s:6:\"active\";b:0;s:5:\"field\";s:5:\"title\";s:5:\"value\";i:1;}s:6:\"status\";a:3:{s:6:\"active\";b:0;s:5:\"field\";s:6:\"status\";s:5:\"value\";i:1;}s:6:\"sticky\";a:3:{s:6:\"active\";b:0;s:5:\"field\";s:6:\"sticky\";s:5:\"value\";i:1;}s:7:\"created\";a:3:{s:6:\"active\";b:0;s:5:\"field\";s:7:\"created\";s:5:\"value\";i:1;}s:7:\"changed\";a:3:{s:6:\"active\";b:1;s:5:\"field\";s:7:\"changed\";s:5:\"value\";i:1;}s:3:\"nid\";a:3:{s:6:\"active\";b:0;s:5:\"field\";s:3:\"nid\";s:5:\"value\";i:1;}s:4:\"type\";a:3:{s:6:\"active\";b:0;s:5:\"field\";s:4:\"type\";s:5:\"value\";i:1;}}s:6:\"filter\";a:2:{s:10:\"node_types\";a:3:{s:6:\"active\";b:1;s:5:\"field\";s:4:\"type\";s:5:\"value\";a:6:{s:4:\"page\";b:0;s:5:\"story\";b:0;s:4:\"book\";b:0;s:6:\"notice\";i:1;s:5:\"forum\";b:0;s:7:\"webform\";b:0;}}s:9:\"published\";a:3:{s:6:\"active\";b:1;s:5:\"field\";s:6:\"status\";s:5:\"value\";i:1;}}s:6:\"fields\";a:3:{s:3:\"uid\";a:2:{s:6:\"active\";b:0;s:5:\"field\";s:3:\"uid\";}s:7:\"created\";a:2:{s:6:\"active\";b:0;s:5:\"field\";s:7:\"created\";}s:7:\"changed\";a:2:{s:6:\"active\";b:0;s:5:\"field\";s:7:\"changed\";}}}') in /home/tammanyt/public_html/dr6_test/sites/all/modules/taxonomy_treemenu/taxonomy_treemenu.admin.inc on line 1591.

Have had somewhat more success with:

1. Reinstalling the 5.4 version and creating a menu
2. Following the 6.0 [upgrade] instructions (not disenabling/uninstalling)

But, after the above steps, as soon as I try to create a new menu with 6.0 I get the above errors (or similar - haven't done a detailed comparison).

As our friend Dr. John might say, "Dis ain't woikin rite!" (Can you tell that he and I are both from New Orleans?)

rcrowther’s picture

Arrgh! I should have BETAed the release. I was worried about this. But I tried a back install on a working site, and that went ok.

I'll look at it!

[Applicable Dr. John song: "Walk on Guilded Splinters"]. Bet Allen Toussaint has a song for this.

rcrowther’s picture

Posted 6.1. Is a bugfix for the problem posted above, and is tested ok. Apology due, I broke the new menu code.

potonfl’s picture

Checkbox selection "Term pages include the nodes from descendant terms" is not saved.

rcrowther’s picture

Ok, 6.2 fixes this and is out.

And I apologise to everyone who is waiting on this.

BayouBill’s picture

Almost there with 6.1...

- Building new menu no longer throws ugly errors
- With the option enabled, clicking on parent term now shows descendant content

But...

1. Initial menu page is displaying duplicate headings. Don't know why. See attached image 1.

2. Clicking on a parent term shows a "messy" heading (image 2). I described this problem in the Taxonomy Menu (that's TM, not TTM) issue queue at http://drupal.org/node/558530. The solution I came up with requires Views.

rcrowther’s picture

Duplicate titles - I'll dig in for this. HTML might pass me some clues though?

Messy headings - ok, I face the same problem as the Taxonomy Menu folks, that the rendering goes out of the module,

however,

I'm prepared to get in there. I've been vaguely thinking for a while that it's a shame I can't get the the internal theme onto stock URLs. And this is much the same idea - how do we get the rendering into the module's circle of magic? Where we get the render generalities out of the templates (you could hack this issue in templates, but I take it as given the folks on my queue are not up for that) and into the interface?

I think the clue has to lie in Views. That overrides everything, right? And should be good Drupal.

It's getting late here, so I got to drop this for tomorrow (like your text work, by the by, even if you can do that for sandwiches).

rcrowther’s picture

Got it. hook_menu_alter(). Can't give you a timeframe. I'll keep you posted.

Question: do you have Views loaded anyway? Views, using the hook, very drastically overrides the menu system (I can't support starting a territory war over URLs such as taxonomy/term/%. Apart from anything else, I'd loose). If you're ducking Views, this is relatively simple, if extensive.

BayouBill’s picture

FileSize
8.33 KB

"Duplicate titles...HTML might pass me some clues though?"

Here is the snippet that renders the duplicate headings:

<h1 class="title">TTM Neighborhood Notices</h1>				<!-- main-content-block --><div class="main-content-block"> 
		<div id="page-menu-menu-ttm-nn04">

<h2>TTM Neighborhood Notices</h2>

I've attached the source for the entire page as a .txt file. This corresponds to image #1 in my #14.

"Question: do you have Views loaded anyway?"

Yes, I've enabled Views and plan to keep it enabled. I did it originally for Organic Groups, which for now I've abandoned for this application - no good way to handle multiple inheritance (multiple parents for the same content, for those who don't know the lingo). Moshe has made it clear that the og structure is flat, and the maintainers of og_subgroups, while they espouse support for multiple inheritance, are not doing anything to implement it. Taxonomy supports multiple inheritance, is a much lighter way to go, and is Drupal Core.

Views was the key to my solution to the "messy headings" problem in TM described in #14. Views is not very intuitive (at least not for me, as I'm a Drupal user, not a Drupal developer, and I'm still only a rudimentary PHP coder), but Views is well supported and is being more widely used, so I don't think it will become another one of the many Drupal orphan projects.

Perhaps you could consider relying on core rendering but also distribute one or more Views with TTM, to handle things like the messy heading problem and other presentation-layer things that people want. This offers the best of both worlds - native rendering to keep your development load as light as possible and for users who want to start with the basics and mod things themselves, and supplied Views to act as a sort of starter/example package for those who want to use that approach to customize what users see.

Check with you in the mawnin'.

rcrowther’s picture

Duplicate titles:

Havn't solved your problem, but I'm a couple of steps forward. I'm assuming(?) your site uses stock URLs.

The H1 (class=title) tag suggests a page template. BlueMarine contains code for rendering such a title.
Garland renders titles with a H2 tag.

The title is provided by the Taxonomy through it's theme (drupal_set_title()).

No idea if the following tip is of help, but here goes:

Tracking down where page content is rendered is difficult, due to the flexible and overidable nature of Drupal's themeing. You can use 'theme developer' (I think that's the name) in the Devel module, and that's what you'll find recommended at Drupal.org. But this piece of magic is very heavy on the javascript and cache, and overloads my little 1GHz setup.

As a (in this case) Linux user, I searched the installation for files containing 'h1' and 'h2' (grep -r "h1 class=\"title\"" .) There's not so many of them, and it's easy to tell where the titles (and all sorts of other rendering) are coming from. I found my dev sites titles in a minute or so. A Windows user just needs a similar facility, to search the contents of the Drupal installation's files. If you have a LAMP stack installation, it might have enough command line code to use a Linuxy search anyhow (sorry, wouldn't know, and if you don't use a command line, the Linuxy solution is too much trouble to learn. Sitll, there may be a Windows way?).

It's an idiot approach, but so long as you can think of a good search, it works every time.

rcrowther’s picture

Messy headings:
Ah, if your site uses Views, well, it will be of no use to implement this internal solution. It's a loss I somewhat regret, because the internal term renderer does titles as you wished, term title only. And the idea is extendable to core term lists.

I still plan on the hook implementation, now I've found it, but it goes down the priority list.

If you have a working Views solution, and it seems neat, I'd use that. I understand you have a job you wish to do, which is your main purpose, apart from being on this list. My response time will collapse in about two weeks time, and Views is poorly documented. That apparently so simple little default View, and the background code need to inject Treemenu options, cost me several evenings - Views is rough on developers too. I'm very chuffed with it, because people are using it and it's just what they wanted. But when I revisit Views, I'm going to need a rucksack and several days provisions (virtually speaking).

I'll look for certain into what more we can offer through Views.

There's some interesting thinking in your post.

There are frequent calls on the dev list to put Views into core. The core programmers seem united in their objection to this, though I've never seen an explanation. My guesses are; it's HEAVY (1/3 of core, and a CPU weight), it has a non-standard interface, non-standard object-orientated code, and is difficult for a user. Thinking about it, saying this would probably start a war.

One upshot though, you're right - Views will NEVER be orphaned.

I feel ambivalent about commentary about Views. See, my slight dealings with some of the maintainers suggests they are some of the most pleasant, considerate people in Drupal. Their module is a genius solution to an issue. They broke off, in a very bold move, to create a fully modular interface, and since Views 2 have taken a crateload of grief for their efforts. Yes, you need a paper qualification to use it. But I've not yet come across anyone (you're the first to hint at it, for me) who will accredit the achievement. It needs some time, to sort out the unfriendly quirks in the AJAX interface, and to mature the underlying function provision. Meanwhile,users get a module that makes a CMS work with the same depth as an image or music editing plugin.

The only other way is to go to code. I'm not at all well traveled in this area, but I have used Ruby on Rails. Rails wipes Drupal in so many ways, but you need a dedicated server, and to learn Ruby, the language. Building a secure commercial website, for long term non-technical staff maintenance, is out of the question. So Drupal's peculiar positioning, with an admin drive, but way deeper than a CMS, and with code access, is perfect. And Views is cool. But cool always is painful to live with...

Humm. Think that dev list gets to me sometimes.

rcrowther’s picture

Messy headings #2

Within your commercial remit, are able to condone use of a page preprocessor?

If so, put this into your [themename]/template .php file. Anywhere.

function [themename]_preprocess_page(&$vars) {
  $q = $_GET['q'];
  $qa = explode('/', $q);
  if ($qa[1] == 'term') {
    $vars['title'] = substr($vars['title'], 0, strpos($vars['title'], ',') );
  }
}

done, and is the Drupal way to go.

The code GETs the url, checks this is a term page, and if so, strips everything in the title until the first comma.
Unwelcome side effect: if anyone uses a term title with a comma, everything gets stripped after the comma.

BayouBill’s picture

Duplicate titles:

"I'm assuming(?) your site uses stock URLs."

Here is the url of the page shown in image #1 of my #14: http://www.tammanytogether.org/dr6_test/ttm/menu-ttm-nn04 (this is public, so you should be able to actually go there).

"The H1 (class=title) tag suggests a page template."

I have tried switching to various Themes (Garland, Bluemarine, Waffles, and Analytic, which is my default for now) and the duplicate titles appear in all of them, so it does not appear to be theme-dependent.

"I searched the installation for files containing 'h1' and 'h2'"

My Drupal installation is on a Linux box at Site5.com. I tried shelling out and using your "grep -r" example, but it ran forever without showing any results, so I aborted it. My Drupal install is not very massive, but I'm not sure whether I should have just waited longer. My client machine runs Windows XP. I tried using windows search to accomplish the same thing. It didn't come up with anything definitive, but I have not exploded every component's tar.gz file into its respective folder on this machine, so the search was not exhaustive.

I'm open to other ideas.

rcrowther’s picture

Yup, I can go there. I'm out of time this evening, but I'll look tomorrow.

Sorry about the search. Just a guess, or maybe you know this much, but the dot (full stop/period) at the end means 'search from current directory'. Launch it from anywhere but inside your personal site folder and it will search from wherever you started, maybe even every file and folder on Site5.com?

I'm not bailing out on this, sorry if I gave that impression. It may be a Treemenu issue, and if so, i want it squashed. I need to be able to replicate the issue though, and we need to build a bridge there (your site not working/my dev site working).

Look, tomorrow morning I'll build a fresh site, hokay? And see if I can track anything down. Rob.

BayouBill’s picture

Re: Duplicate titles

Okay, I've found the culprit that is generating the following html, which results in the duplicate (lower) title (you'll find it in my #17 and its attachment):

<div id="page-menu-menu-ttm-nn04">

<h2>TTM Neighborhood Notices</h2>

This code is generated in function theme_taxonomy_treemenu_page($ttm) of taxonomy_treemenu.module. I commented out the line that reads $output .= '<h2>'. $ttm['title'] ."</h2>\n"; and the duplicate title disappeared.

The first (<h1>) instance of the title is obviously being generated someplace else, but I have not taken the time to find out where, since we want to keep it.

Do you see any harm or unexpected consequences in disabling the above <h2> code?

Edit: Unrelated to the actual problem, but to improve cosmetics when a description is present, in the same function I have modified this line $output .= '<div class="content clear-block">'. $ttm['description'] ."</div>\n"; to read $output .= '<div class="content clear-block">'. $ttm['description'] . "</div><br>\n"; (added a <br> at the end).

BayouBill’s picture

Re: Messy headings #2 (comment #20):

"put this into your [themename]/template .php file"

The analytic theme has a function phptemplate_preprocess_page(&$vars) in template.php, so I pasted the code there. It worked to produce a title showing just the parent term.

I will continue to work on a Views solution so (a) distributed code doesn't need to be modified, which is one of the primary advantages of using Views, (b) the approach is theme-independent, and (c) the unwelcome side effect mentioned in #20 is avoided.

BayouBill’s picture

Re: Messy headings

"I will continue to work on a Views solution..."

Done. I've attached a Views definition that should work when using the default TTM path (taxonomy/term/parent_termid+child_termid1+child_termid2...). For simplicity, this has only a "page" display (no feeds). If you understand how Views works, you can tweak this to get the results you desire.

Disclaimers: I have only tested this with a two-level taxonomy hierarchy (parent-child, no grandchildren). Also, this View will affect any presentation that uses the default taxonomy path as described above, so further tweaking may be necessary so it applies only to TTM menus. One way to do this would be to enable the "Prefix term and node link urls with the menu name" option of the TTM definition and to modify the Path option of the Page display, and "n" in the arg(n) parameter in the second line of the validation code of the Argument of the View accordingly.

Suggestion: If this passes muster, it could be distributed with the module as an example.

Bonus: I think that this closes out, at least for me, all of the issues that have been raised in this thread.

BayouBill’s picture

Sorry, but the View attached to my previous post (#25) contained some parameters unique to my project. They are not actually used in the execution of the view but are there nevertheless. Please use the View definition attached to this comment instead.

rcrowther’s picture

I know why the duplicate titles. Fix coming as soon as I decide how.

rcrowther’s picture

Check 6-3. Rob.

Sorry, Didn't spot #23, as I'd already got my result.

This is an unacceptable error. Should it have been marked as critical, despite the small size, that would be fair.

In the event, I have retained the theme title, and removed the other.

The code, for all that, is kind of correct in it's action. It is generating a title for the page, through drupal_set_title(). However, unenabled functionality - that theme is there because TTM can put multiple menus on a page. So there is a title for each menu, too. But then you wind up with two titles, if there is only one menu. And at present, you can only have one menu.

RE: Views (and the presentation HTML/CSS). I'm up for putting your work into the module. Since you have a working solution, I'd like to do this later? Me, I'd prefer a less frantic and public release schedule?

RE: "...will continue to work on a Views solution so (a) distributed code doesn't need to be modified, which is one of the primary advantages of using Views, (b) the approach is theme-independent, and (c) the unwelcome side effect mentioned in #20 is avoided."

The issues covered in this particular post are not the only posts with this general background standing at their shoulder.

It seems that, well, I'm not sure how you would describe this, but commercial designers who work at a mid level are very interested in how this module controls rendering from admin, for the reasons you state here. My original plan was 'non-contextual menu rendering, put a menu where you want'. But since Drupal doesn't make menus from the Taxonomy, that extended to, 'how do you want the menu?'

From here on out, 'Admin control of menu rendering generalities' is a stated aim of this module.

BayouBill’s picture

"Check 6-3."

That fixed the duplicate titles, and the approach you used (h2 rather than h1) is fine with me appearance-wise.

This is not critical, because I can force a blank line by adding <br><br> at the end of my Description text, but if you agree it would improve the default cosmetics, please see my "Edit: Unrelated to the actual problem" patch at the bottom of #23.

Perfectly okay to include my contributions/suggestions in the module, and throttling down the release schedule is fine now that we've got fixes for both the duplicate and messy title problems. I may submit a feature request or two, but priority will be "normal".

Thanks for all the help and, again, for being so responsive. I wish all module developers were able to work the same way.

rcrowther’s picture

HTML fix is smart, and will go in next release.

Views will at least go in help, along with relevant text, pending me getting my teeth into Views again.

Both substantial issues closed, so posting closed. Hurrah!

rcrowther’s picture

Status: Active » Fixed
rcrowther’s picture

Humm, when it came to it, I don't like 'break', as it's HTML unrelated to content. However, the titling does look lousy out of the can, so I've extended the HTML and put in a snippet of css. Apologies to anyone whose site changes under them, but I'm with Bayou on this one.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.