Closed (fixed)
Project:
Printer, email and PDF versions
Version:
6.x-1.8
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2009 at 19:08 UTC
Updated:
16 Aug 2013 at 22:28 UTC
First, thanks for such a great module. It's incredibly useful.
I was wondering if it is possible to have multiple templates for a single node so that one node could be printed in several different template formats? I know the current structure is one template for print, one template for PDF, one template for email per node, but could one node type have 2 templates that can be chosen from ,e.g. links with "Printer-friendly version 1" and "Printer-friendly version 2" with each corresponding to a different template file?
Thanks so much.
Comments
Comment #1
jcnventuraThe template file is PHP, so you can embed the logic to handle these two templates in the same file and choose between them via an 'if'.. The condition to choose between the two templates will have to be implemented by you somehow..
João
Comment #3
haver commentedI just wont to ask help on how to implement embedding of two templates in the same tpl.php file?
I can imagine how to implement the logic, but how to build tpl.php murkup?
If for example i add to my content type a cck field whith checkbox - "Print version1" and the second field
- "Print version2". If the checkbox is checked it store some value.
Then in tpl.php i first load the field and check the value and if it exist i need to load "Print version1" murkup.
But when i open "if" operator condition, how to place html murkup inside it?
I understand it looks like bad practise.
If some body can help whith more clean solution, working code examle how to implement two temlates in one tpl.php with "if" condition?
Comment #4
jcnventuraYou can place the murkup easily following the HPH programmation tongue syntax:
http://www.php.net/manual/en/control-structures.alternative-syntax.php
Now seriously, this is basic PHP. Be sure to know what you're doing.