By nancydru on
This is very strange, I have one content type that is not loading $node->taxonomy when being themed. I went into node.tpl.php (no custom templates) and did a print_r($node). For most content types, $node-taxonomy is loaded, but for this one, it is not. What could be preventing that? Just to make it a little stranger, it's fine in 6.4, but not in 5.10.
Oh, I have also tried two different themes (Bluemarine and Garland) with the same result.
Comments
Silly question, are you sure
Silly question, are you sure there's a Vocabulary assigned to that content type?
Quite sure
Yes, I double checked. However, the module is taxonomy-based so it wouldn't even function otherwise.
NancyDru (formerly Nancy W. until I got married to Drupal)
NancyDru
Do you have a separate node
Do you have a separate node tpl file for that content type... Such as node-movie.tpl.php? If so, make sure the relevant code is there. If not, try making one, by copying your node.tpl.php file and naming it: node-custom-name-here.tpl.php Custom Name Here being the Machine Readable name of your Content Type.
I am readily assuming here though that you have more than one content type, and the taxonomy displays for the others...?
Yes
Yes, it displays for the others. No, I do not have any custom node templates. I created a custom template that was just a copy of the standard one. It still doesn't show the terms.
NancyDru (formerly Nancy W. until I got married to Drupal)
NancyDru
What modules are you using?
What modules are you using? That would be a start.
Also, under your Content Type Admin Settings, goto: Display Settings and Make sure the Taxonomy displays for the Full Node.
Not CCK
This is not a CCK content; I have never heard of such a setting in anything but CCK. This is the Web Links module.
NancyDru (formerly Nancy W. until I got married to Drupal)
NancyDru
Currupt data?
Have you run the sql directly? For D6 & D5, using the revision vid and if that fails, the node nid (thinking corrupt vid):
Notice that if the revision doesn't get updated in that module, and it handles it's taxonomic relationships itself, you'll keep lossing the terms.
Theming functions don't load these directly, but a call to
taxonomy_node_get_terms($node)may be a work around at the theming layer, if the above SQL works that is!Alan Davison
www.caignwebs.com.au
Alan Davison
Oops
I don't know what the point of this query is, however, it is flawed. Term_node does not have a vid column (WHERE r.vid=xxx). Remember that D5 does not track revisions to terms. It is unlikely that revisions is the problem since it is turned off.
I changed the query to
Everything looks right.
The module does not manage the terms itself; we are quite happy to let core do that. When I edit the node, it shows the correct terms, so the relationship is still intact.
Yes, I could fix it on my site, but my users aren't helped. I am a co-maintainer on this contributed module. I cannot provide a theme solution for every possible theme there is.
NancyDru (formerly Nancy W. until I got married to Drupal)
NancyDru
Quick fix using the hook_nodeapi
By any chance, do you have any other modules that are setting the $node->taxonomy value. It sounds like either this is being overwritten by another module or maybe by mistake during a conditional check or something.
The taxonomy load could be moved another hook_nodeapi('load',..) or hook_nodeapi('view', ..) as a temporary fix while the real problem is investigated further.
Just had a play with a new idea for a debugging tool, and I came up with the following class. It will only help is the call is deep in core, as it does kill the processing of the node, resulting in a 404/blank screen.
If you throw in this wrapper in before the line in node.module after the fetch object call, it may help track the problem.
PS: I missed the vid/nid in the query while I was taking a quick look at the functions, sorry about that.
Alan Davison
www.caignwebs.com.au
Alan Davison
So far
I added this to the hook_view, immediately before the return:
And the correct taxonomy section is there.
Further, I have a block that shows the terms of the current node and it shows them correctly.
I did check and the site that is messed up does have revisions. I have another 5.10 site that does not and it is properly showing the terms.
NancyDru (formerly Nancy W. until I got married to Drupal)
NancyDru
another update
If I access the nodes through taxonomy/term/406 or node/type/weblinks the terms show up correctly.
NancyDru
Trying to track this down
Okay, here's what I have found so far:
node_build_contentis being called twice for each node display. Within it, there is a call tohook_nodeapi('view'). After the first call, the taxonomy section is still present, but after the second call, it is gone.The taxonomy module does not have "view" processing, so we can eliminate that module. My module also does not do "view," so we can probably leave out shooting myself in the foot.
NancyDru
Found it
It's in another one of my modules...
NancyDru
Nice one
Was it a bug in one of the mainstream modules or a custom one?
Alan Davison
www.caignwebs.com.au
Alan Davison
Contrib
Taxonomy_image_node_display. It is fixed now.
NancyDru