I've been having this problem where views attach won't render on my nodes. The only views attach output I'd see is:
<div id="-" class="view view- view-id- view-display-id- view-dom-id-"> </div>
I've tracked the problem down to node types that don't have a body. I'm using a module defined node type where 'has_body' is FALSE. Another node type is one created in the Drupal UI with an empty body field label.
If I enable the body, clear the cache, and view my node, the attached views appear.
If I disable the body and view my node, the attached views are not there.
Comments
Comment #1
Anonymous (not verified) commentedFYI: My views are configured to display on the 'Full node' build mode.
Comment #2
Crell commentedThat is highly weird, since we never use body fields, ever, and views_attach works fine. :-( Although we've not tried it on module-defined node types. Can you confirm that it's just module-defined node types that are an issue?
Comment #3
Anonymous (not verified) commentedI'm willing to believe that it is highly weird then. What is the emoticon for pulling out one's own hair? ;-)
Comment #4
Anonymous (not verified) commentedMerlinofchaos helped me track down the essential problem here, and it has a workaround. It has absolutely nothing to do with title-less node types, so I'm changing the title of this issue.
The template_preprocess functions are not being called by Drupal's theme layer when the active theme has overrides for the templates. I put "die();" at the top of views_attach.theme.inc after clearing and reconstructing the drupal cache, and my request was processed correctly, which tells me that views_attach.theme.inc isn't loading when the .tpl.php have been overridden.
A workaround:
Copy the template_preprocess_views_attach_display_node_content_view and template_preprocess_views_attach_display_profile_view from views_attach.theme.inc and put them into your theme's template.php. Rename them as necessary.
Comment #5
Crell commentedUgh, I think I've seen that issue before. I spent a while tracking down something similar to the theme discovery system in core. I could have sworn I posted an issue about it somewhere, as I couldn't work out exactly what the correct fix was, but I can't find it at the moment.
I'm leaving this issue open for documentation purposes for now, but I don't think it's a bug in views_attach per se but with core's theme system.
Comment #6
nicholasthompsonJust to add - I'm experiencing the same problem with a purely CCK formed node type. It works the first time from a clean cache, but the second time I get an empty DIV with no data in it...
I'll try copying the preprocess stuff..
Comment #7
nicholasthompsonI can confirm that copying the two preprocess functions mentioned above from views_attach.theme.inc into your own template.php (and renaming the functions appropriately) works fine.
What an odd issues - I've not seen anything else in Drupal 6's theme layer that suffers the same problems...
Comment #8
socialnicheguru commentedfacing a similar issue. thanks!
Comment #9
rhache commentedAlso encountered this.
I only had this happening once I created a tpl override for a node content display.
Thanks,
Rene
Comment #10
Crell commentedTo those having this problem: If you move the preprocess function to your .module file, does the problem go away?
Comment #11
Anonymous (not verified) commentedCrell:
Yes. I didn't propose this because it's hacking the module. Having the template_preprocess functions in the module file means they're loaded anyway.
Comment #12
Crell commentedYes. My point is that if that works, it means this is definitely the previously mentioned bug in the theme system. I don't know how to fix said bug, sadly, but it means that's likely the root cause. :-)
Comment #13
nachenko commentedI can confirm the problem is that given certain conditions, the system doesn't include attach_views.theme.inc file. This code:
include_once('views_attach.theme.inc');in views_attach.module file, line 95 (inside hook_nodeapi implementation) fixes (workarounds, I'd better say) the problem.
Comment #14
Crell commented#591804: Theme registry build bug: External file with template_preprocess is not loaded if tpl.php is copied into theme is the problem in core. I thought I'd submitted an issue for it, but looks like rfay did as well. :-) That's where this needs to get fixed.
Comment #15
Crell commented#489254: theme file not getting included - Ah, here's the issue I had submitted on the same subject.
Comment #16
Crell commentedSo I've confirmed that this is a core bug, and the fix has nothing to do with views_attach. Therefore I'm marking this as fixed, since from the views_attach standpoint it is and I want to keep my issue queue clean. :-)
Until this gets fixed in core, the patch mentioned in #14 works perfectly for me.
Comment #18
owntheweb commentedSorry to bug on this. I'm in the same boat with my node-speaker.tpl.php. I don't have patch abilities readily available. Using the option from #4. How would I rename the functions if my theme name/folder is happytheme? A happy theme and views_attach showing up on the page would make me happy. I am able to get results in the view preview and node edit page, just not the full node.
happytheme_preprocess_views_attach_display_node_content_view?
Thank you,
Chris
(I'll leave this issue 'closed')
Comment #19
emi_bcn commentedHello there,
I'm also using this great module, and I'm having troubles too. My scenario:
that view shows templated nodes: I've tried to delete the template. After flushing caches, disabled the relationship on the view (associating this view to other contents not in here), controlled that the affected nodes are shown correctly and re-enabled the view: the error persists.full node Row Style: Tried to change the other view attached I have (with Fields row style and without template) to show as Node row style, and continued to show correctly. Tried some clicks to see if caches affected, and not. Tried to reflush all caches and anything changed: everything running as expected.I've tried the workaround on comment #13, but it's still doing the same. I'd like to test #4's, but I'm completely unsure as how the function must be named. I've reopened the issue just wondering if someone sees it and answers to me and to #18's.
I've also tried to do something with Devel module, but when it's enabled, the desired pages take too much memory (I've raised it to 128MB and still going out of memory).
I've tried too the patch posted at #591804: Theme registry build bug: External file with template_preprocess is not loaded if tpl.php is copied into theme, but no luck.
I've posted this to give more information about the problem, if needed or if someone wants to resend this info to #591804: Theme registry build bug: External file with template_preprocess is not loaded if tpl.php is copied into theme.
Thanks a lot by this great job!!
emi
Edit:
Some more info into the scenario. It's del'ed or bold.
Comment #20
Anonymous (not verified) commentedemi bcn:
The rules for naming theme functions, templates and preprocess functions is documented here http://drupal.org/node/223430
The symptoms of the original bug were never ever 404 errors and fatal errors of crossing the PHP memory limit. It sounds like you have a combination of problems.
Please do not re-open a closed issue to report complex trouble like this. When you've got a Drupal syndrome like this, your best option is to seek support in the forums, IRC or local support in your community. Politely ask for help diagnosing the problem. If you can narrow down the problem to a NEW bug or undocumented support request, file an issue.
Comment #21
emi_bcn commentedHi again!
Thanks for the info and sorry for opening the issue again, just trying to get the requested info.
I have debugged the problem, it's related to nodereference CCK field presentation merged with attached_views. It tries to show full node "referenced" node inside all nodes in the attached view, what, depending on your configuration, it calls attached view again for every node it shows on. Here it is: infinite recursion of nodes.
If someone has the same problem: go to your referer content type (the one which has a CCK field referencing to the other one) "Manage fields" tab and switch all visibilities to hidden (or just the one you use on your attached view). This will prevent infinite recursion.
Module maintainers: May be views_attach should be aware of this and alert you if it detects this infinite recursion problem. If not, at least mention this possibility on some part of the docs. Consider open an issue yourself.
See you!!
emi
Comment #22
Crell commentedemi_bcn: Do not post new issues into an existing queue. Your issue has nothing to do with this thread, and it is simply noise. Post a new issue if you need.