开发者

What does 'engine' refer to in Drupal Theming?

I've been reading about Drupal theming and preprocess functions and noticed they listed engineName_engine_preprocess & engineName_engine_preprocess_hook i开发者_高级运维n the order of preprocess functions but I'm not entirely sure what the engine layer is? I understand about the core, includes, modules and themes.

Many thanks


I try to make it very simple.

Template engines in Drupal are software components that combine Data from Drupal with Templates from themes and show the result -which is final HTML- to the user.

   
    +-----------+        +----------------+
    | Data from |        | Templates from |
    |  Drupal   |        |     theme      |
    +-----------+        +----------------+
          |                       |
          v      +--------+       v
          +------| Theme  |-------+
                 | Engine |
                 +--------+
                     |
                     v
              +-------------+
              |  Final HTML |
              +-------------+               

Why Drupal uses theme engines? Because different developers have different coding tastes and Drupal does not want to deal with different template "coding styles" directly.

If you are learning Drupal theme design, you do not need to know theme engine design. Now a days, almost all Drupal themes use one engine: PHPTemplate which -in my opinion- is brilliant. You only need to know the theme engine API if you want to design advanced themes. For basic usage, even API knowledge is not a must.

For a simple start, try reviewing and tweaking a simple Drupal theme -like Bluemarine


The engine is the template engine used. By default Drupal uses the PHPTemplate engine but you could use other template engines and thus create different preprocess hooks based on the engine type.

The template engine is what is used to run the code in the templates. There are different kind of template engines that will allow you to do different stuff with different syntax in your templates, different ways of getting your variables to the template etc. The PHPTemplate uses files ending with .tpl.php. So all those work because there is some code than can interpreted them

Read for more info on PHPTemplate (some old history)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜