Can I mix several template engines?

yojoe - February 21, 2007 - 10:24
Project:PHPTAL theme engine
Version:5.x-1.0
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Is it possible to mix several template engines on the same drupal site? I'm using the Garland theme and need continue using it, and right now, there is no Garland port to PHPTAL. But I would like to try out PHPTAL to just theme some CCK node types.

#1

olav - February 21, 2007 - 17:04

Jörg,

the answer is an unfriendly "no!", I'm afraid. At least not out of the box.

It might be possible to write phptemplate functions to wrap a TAL template file, though.
To have something like in your template.php this might work (untested):

<?php
require_once 'sites/all/themes/engines/phptal/phptal.engine';

function
_phptemplate_block($vars, $suggestions) {
  global
$theme_engine;
 
$old_engine = $theme_engine;
 
$theme_engine = 'phptal';
 
$result = _phptal_default('block', $vars, $suggestions);
 
$theme_engine = $old_engine;
  return
$result;
}
?>

I would be interested to hear about your experience with this.

-- Olav

#2

dvessel - February 15, 2008 - 06:52

Not sure about 5 but in 6 it's definitely possible by setting up your render function to detect the extension then pass it off to various rendering routines.

 
 

Drupal is a registered trademark of Dries Buytaert.