Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am using the Print module.

I have enabled the node/%node template in panels and used a selection rule to select my specific node type and added fields into the panels regions etc. That all works fine.

I need to be able to use the Print module to see a print-friendly version of this node. However when I go to /print/[nid] I just get a completely blank page.

So is it possible to have a printer friendly version of a panels page? i.e in a template file or another method?

share|improve this question
    
I don't recall needing to do anything the last time I used the Print module w/ Panels. –  MPD Oct 15 '12 at 15:56
    
Yeah I just tested on clean site. It does work w/ panels. It must be another module causing something to go wrong here. Thanks. However i'd also need some information that isn't directly related to the node, such as a view for example (which has been added to the panel). For this do I need to render a view into the node template? –  Billy Oct 15 '12 at 16:07

2 Answers 2

Checkout the piece of code here. Just copying it here for reference

Create a function as follows in template.php

function get_panel_view(&$node) {
    // Load my task plugin
    $task = page_manager_get_task('node_view');


    // Load the node into a context.
    ctools_include('context');
    ctools_include('context-task-handler');
    $contexts = ctools_context_handler_get_task_contexts($task, '', array($node));

    $output = ctools_context_handler_render($task, '', $contexts, array($node->nid));
    if ($output !== FALSE) {
        return drupal_render($output['content']);
    }
    // Otherwise, fall back.
    return drupal_render(node_view(node_load($node->nid)));
}

Template should be called print--node--.tpl.php and you can print it as

print get_panel_view($print['node']); in place of print $print['content'];

Rebuild theme cache

share|improve this answer
    
Thanks for that. I will test it. –  Billy Oct 15 '12 at 16:08
up vote 0 down vote accepted

Thanks for the help above.

Coding was the last option I wanted to take here. In the end I achieved what I needed without it.

Firstly, I configured the Print module to also print non-standard node pages (so panel pages and views as well). Still would not work.

So, I created a copy of my panel with the url 'node/%node/print-friendly' and used panels stylizer to style it very bland. Then I was able to link to the copy panel as '/print/%node/print-friendly' and it works perfectly!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.