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

jcnventura’s picture

Status: Active » Fixed

The 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

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

haver’s picture

Status: Closed (fixed) » Active

I 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?

// Version 1 of my.tpl.php
if ($version1_choise_field  ==  '1'):

//Version1 murkup whith php e.g.: 
echo "<div>some text";  print $somevariable;   echo "</div>"; 
// how can i place html murkup whith php inside it like usual in files of type .tpl.php ???
endif;

// Version 2 of my.tpl.php
if ($version2_choise_field  ==  '1'):
 Version2 murkup whith php
endif;

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?

jcnventura’s picture

Status: Active » Closed (fixed)

You 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.