Closed (fixed)
Project:
Printer, email and PDF versions
Version:
6.x-1.10
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Jan 2010 at 14:11 UTC
Updated:
7 Apr 2011 at 00:38 UTC
I just started using this module. I'm using Content Template to make a custom template, and also the views_attach module, for one of my node types. (The view I'm attaching is a list of noderefs created by users.)
In my template, I use this code to show the attached view in the page content:
print $node->content['attachedviewname_node_content_1']['#value'];
The printer-friendly version handles everything else in my custom template just fine, but I can't get the attached view to show up there....any way to make it work?
Thanks in advance!
Comments
Comment #1
jcnventuraHave you tried to add that line to the print.tpl.php template??
João
Comment #2
Lanae commentedYes, I tried adding it to the module's print.tpl.php file, and also tried it adding this before it, as suggested in your documentation:
I also tried to create a print.node-type.tpl.php in the theme directory, using my code from the Content Template that prints the view. This is what I'd prefer since it's only the one node type that uses the attached view. I tried clearing Drupal's cached data and going to the theme config page, but this didn't change the PF page either - still no attached view.
Here is what my print.tpl.php (in the module's directory) now looks like:
(also, I clicked the wrong version first time, sorry...I'm using version 6.x-1.10.)
Thanks again for your help!
Comment #3
Lanae commentedSo...should the above have worked, or am I doing something wrong?
Comment #4
tfrech commentedDid you get anywhere with this problem yet? I have the exact same situation. I think the print module doesn't include the attached views in its node object. I can print_r the $print object and I can find:
but if I print_r the node object from the normal node view I get the same thing but I also get:
Comment #5
tfrech commentedI would be very interested to know if anyone has resolved this problem. I have put my project on hold because of this issue but I will need to get back to it soon. Any ideas, even module hacks would be appreciated.
Comment #6
tfrech commentedEureka!
Here is what you need to do:
At the top of your print template file, put this
yourviewname is the name of the view that you are loading
yourdisplayid is the name of the specific display which is usually "node_content_1"
You should do this for each of the views that you are embedding into the node.
Comment #7
jcnventura