There is a default templating system PHPTemplate in Drupal, they say.

But where can I see it? I don't see anything more than pure php in template files .tpl.php. Once I've seen template system Smarty in non-drupal webpage files and there was tempalting syntax with { } braces in .php files with HTML. I also have seen Blade templating syntax in Laravel framework's files.

So where is the PHPTemplate in Drupal (or how it works and what it do?)

  • Welcome to Drupal Answers! It's not clear what you mean by "where is the PHPTemplate in Drupal." The template engine's functions are documented here. The fact a template engine doesn't use any particular syntax doesn't mean there isn't a template engine. – kiamlaluno Apr 19 '15 at 5:26


A theme engine that allows you to use template files written in pure php. These template files do not need to be processed by the theme engine, and as such execute a lot faster than most other template engines. Another major advantage to using PHP as your template language, is flexibility, as the advanced user can access any information / functionality available in the Drupal API, and is not restricted to what the template engine / language allows him to do.

This is the default theme engine starting in Drupal 4.7. If you are using Drupal 4.7 and above, you don't need to download PHPTemplate here.

A Template system does not need to use special code or markup to be called a template. PHPTemplate refers the system of implementing pure php code template files, how those files are accessed and referenced by the system and how other parts of the system (such as template.php) can modify the results of those files

| improve this answer | |
  • Actually, the template engine is using code, but not for handling the markup, which is plain PHP. Without that code, anyway, the template engine would not work, since it would not use the template.php and the template files. – kiamlaluno Apr 19 '15 at 5:29
  • @kiamlaluno I never said it didn't use code, only that it didn't need to use its own language in order to be called a template. The template system can also use sql calls if you continue further up the chain, but that also seemed irrelevant to the generality of the question, and my answer – Geoff Apr 19 '15 at 6:41
  • I didn't mean you were wrong; I added a note to "does not need to use special code." It doesn't need to use special code to render the template, but no rendering code doesn't mean no Drupal template engine; and no rendering code in the template engine doesn't mean no rendering code at all. It seems the OP is getting confused by that: He seems to think that, since the template engine is not using special markup, there isn't a template engine. – kiamlaluno Apr 19 '15 at 7:09
  • fair enough - it sounded to me as though you were arguing against what I wrote – Geoff Apr 19 '15 at 7:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.