Comparison of PHPTemplate and Twig theming paradigms

This page compares PHPTemplate to Twig. The Twig effort is currently in progress, so there will be changes and additions to this doc.

For more information, see:

About Twig

Twig is a PHP-based compiled templating language. When your web page renders, the Twig engine takes the template and converts it into a 'compiled' PHP template which it stores in a protected directory in sites/default/files/php_storage/... The compilation is done once. Template files are cached for reuse and are recompiled on clearing the Twig cache.

The Drupal Twig initiative shares the same motivation as the Symfony initiative: to adopt a modern, powerful, OOP-based engine that will allow developers to concentrate on Drupal proper.

1. Doc block

PHPTemplate:

  <?php
 
/**
   * @file
   *  File description
   */
 
?>

Twig:

  {#
  /**
   * @file
   *  File description
   */
  #}

2. File and function names

PHPTemplate file: node--article.tpl.php

Subscribe with RSS Subscribe to RSS - phptemplate