Closed (duplicate)
Project:
Printer, email and PDF versions
Version:
7.x-1.0-beta1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Feb 2012 at 09:46 UTC
Updated:
14 May 2012 at 07:29 UTC
Hi,
I have a custom page.tpl for certain content types. In template_preprocess_page, i add the name of my custom .tpl to the 'theme_hook_suggestions' array in my $variables array. Now, the only difference between the two templates is some markup (layout), so all the included css & styles are basicly the same. Yet, the send to printer link functionality doesn't work from within the suggested template. I've tried to check if there are differences in vars send to certain functions in print.pages.inc, but so far everything seems to be the same coming from both templates... Yet it only works from page.tpl.php
Any suggestions to what might be causing the problem ?
Comments
Comment #1
jcnventuraDid you keep the
$print['sendtoprinter'];line in your template?Comment #2
jcnventuraNo further info in more than two weeks. Closing the issue.
Comment #3
30equals commentedReopening..
Sorry about the delayed response.
Just to be clear, i have a page.tpl and another .tpl specified for certain node types in my preprocess_page with the theme_hook_suggestions. Neither one has any print variables in it (so no $print['sendtoprinter'] or anything), but still the page.tpl works, and the other one doesn't. If i add $print['sendtoprinter'] and $print['scripts'] in my custom tpl, it works.
But i wonder why i need to add those variables to my custom template, and not my page.tpl.php ?
Comment #4
jcnventuraThe print.tpl.php template is REQUIRED by this module to work. It is similar to the page.tpl.php but you can't replace one with the other, as page.tpl.php is used to build a normal Drupal page, and print.tpl.php is used to build the output of the module.. To be able to send a page to the printer directly, the page itself must have a Javascript script in it that tells the browser to do so. If you customize print.tpl.php in a way that the print variables from the default template are not maintained, then you're proceeding at your own risk.
In this case, you deleted the variable that holds the script that that sends the page to the printer, and then you came here to complain that it doesn't work..
Please try to understand what you're doing next time.
Comment #5
30equals commentedHi,
Me again, reopening as clearly you don't understand what the problem is:
1) i didn't replace, alter, etc... print.tpl.php in any shape or form
2)i didn't copy print.tpl.php to my theme folder
3)i am printing the links through the configuration settings of the module, not directly in my templates
4)when clicking on the send to printer icon from within my page.tpl.php it works, from within page__MYCUSTOMTEMPLATE.tpl.php it doesn't
and i'm sorry, but i was trying to be constructive in my posts, in contrary to you who says i'm complaining, go figure.
Comment #6
jcnventuraOK.. Sorry for the last reply..
Getting back to the beginning.. As I can't understand what you're asking..
You've got a page{etc}.tpl.php. Nothing to do with the print module then, but you're expecting it to send to printer. Apparently, you've also got a page.tpl.php, which works. Nothing to do with the print module again, except for the fact that the page.tpl.php includes the regions in which the links are added.
The "send to printer" setting has nothing do with the page templates.. The module uses the print.tpl.php template, and once a path beginning with print/ is called, it uses that template. Inside, there's a line that adds the script to send the page to the printer.
Unless somehow you modified the print_preprocess_print() function... If you did, I have no idea on how your setup is operating.
Comment #7
30equals commentedWell, both my templates have the print links. The only difference between those two is some structural HTML.
I haven't changed any print module files, nor have i modified the print_preprocess_print() function...
But when i click on the printer icon in my page.tpl, the send to printer works, if i click on the printer icon in my other template file, the send to printer functionality doesn't work.
All i'm doing is adding the extra template to the 'theme_hook_suggestions' array in my template_preprocess_page function.
Comment #8
jcnventuraIs there a URL to this site, that I can test it? What you describe seems to have no logical reason..
Comment #9
30equals commentedNo url, only locally.
Comment #10
jcnventuraNothing I can do then..
Comment #11
jcnventuraI still don't understand why the "send to printer" alone wasn't working, but while investigating #1533312: Print page not working on a custom template, I discovered that the whole printer-friendly versions functionality is broken when using custom templates.. That must have been what caused your problem also.
I'm marking this as a duplicate of #1533312: Print page not working on a custom template.
Comment #12
30equals commentedthnx for the update, i'll take a look at it!