Hi, the general tpl naming convention for print/PDF templates looks like this:
$variables['theme_hook_suggestions'][] = "print__node__{$type}";
$variables['theme_hook_suggestions'][] = "print__node__{$type}__{$nid}";
$variables['theme_hook_suggestions'][] = "print__{$format}";
$variables['theme_hook_suggestions'][] = "print__{$format}__node__{$type}";
$variables['theme_hook_suggestions'][] = "print__{$format}__node__{$type}__{$nid}";
Above code is from print.module. I guess this naming convention is for node, not mentioning page from panel or views.
I've checked this post http://drupal.org/node/565856. This post didn't actually talk about the name of pdf template for panel page or views page.
Saying, I have a panel page "about-us", and the print url is "print/about-us". I checked page "print/about-us" source code. Apparently, this page uses the default print.tpl.php template to render this page. So, if I want to override this template, using a different template instead of the default one, what the name should be for that template?
Any help will be appreciated. Thank you.
Comments
Comment #1
jcnventuraThe template for non-nodes is print.tpl.php. There's no templating system available for non-content Drupal-generated pages.
Comment #2
smiletrl commentedHi, jcnventura, thanks for yout replay.
I think the only option here is to use hook_menu_alter to change page callback for sepecific page.
Comment #3
jcnventuraIt might be easier if you do some PHP inside print.tpl.php to include another template or similar.
Comment #4
smiletrl commentedThanks, jcnventura
I guess I could do it like this:
If this works, that will save a lot of time. Thanks again!
Comment #5
smiletrl commentedHi, this works.
The only thing we need to change is ommit 'print' from url. So, this would be
where 'default_print.tpl.php' represents the default print.tpl.php from print module. Hope this could help others who share the same problems with me.
And again, thanks jcnventura.
Comment #7
heyddi commentedThanks for #5, really helped me :)