- Drupal 6 Theming Cookbook
- Karthik Kumar
- 746字
- 2021-04-13 16:56:43
Drupal themes can consist of a multitude of files each with its own purpose, format, and syntax. This recipe will introduce each of these types with an explanation of what they do.
It will be useful to navigate to the Garland folder at themes/garland
to browse and view the files inside a typical, fully featured theme. Garland also uses the PHPTemplate theming engine which is the most commonly used and recommended engine across Drupal's core and contributed themes.
The following table outlines the types of files typically found inside a theme's folder and the naming conventions to be followed for some of them.
Type Mandatory? Descriptionmytheme.info
Yes Configuration file which provides information to Drupal about a theme named mytheme.page.tpl.php
Yes A template file which determines the layout of all Drupal pages.node.tpl.php
No A template file which determines the layout of a node inside a Drupal page.block.tpl.php
No A template file which determines the layout of a block.*.tpl.php
No Other template files which allow the customization and styling of themable aspects of Drupal.style.css
No CSS stylesheet—if this file exists, it will be automatically included in the theme.script.js
No Javascript file—if this file exists, it will be automatically included in the theme.*.js
No Other Javascript files which will need to be explicitly included in the.info
file.favicon.ico
No Shortcut icon—if this file exists, it will be automatically included in the theme unless overridden from within Drupal.logo.png
No Site logo—if this file exists, it will be automatically included in the theme unless overridden from within Drupal.screenshot.png
No Theme preview image—if this file exists, it will be automatically included in the theme.template.php
No PHPTemplate master file where some of the more complicated and powerful tweaks and overrides occur.
Perusing the contents of each of the available files will prove very useful as we go along developing our theme.
When a theme is added, Drupal first parses its .info
file. This file, as its extension suggests, provides information about the theme such as its name, Drupal version compatibility, regions declared, CSS stylesheets used, JavaScript files included, and so on. In other words, Drupal uses it to find out the configuration and features of a theme.
The .info
file also specifies the theming engine being used by the theme which, by default, is PHPTemplate. Theme engines allow theme developers to communicate with Drupal using a simpler and more convenient interface commonly via template files. A number of them also introduce their own language formats for use in these template files.
Template files in PHPTemplate themes are those that use the .tpl.php
extension. Unlike other engines, these files just use PHP and HTML and do not rely on any special markup languages.
Other theme engines besides PHPTemplate are also available. However, only a handful of themes in Drupal's contribution repository rely on them.
The PHPTemplate engine is the most widely prevalent theming engine used in the Drupal ecosystem and is a part of the Drupal core package. Themes using other engines such as Smarty or Xtemplate are rare and will be structured quite differently. A list of engines can be found at http://drupal.org/project/Theme+engines.
- Core Data iOS Essentials
- Premiere Pro 2022從新手到高手
- SOLIDWORKS 2021中文版基礎入門一本通
- Cinema 4D電商美工與視覺設計案例教程(培訓教材版)
- AutoCAD 2018中文版基礎教程
- Photoshop+Illustrator商業廣告設計從入門到精通(第2版)
- 碼上學會:中文版Creo 3.0機械設計全能一本通(雙色版)
- Adobe創意大學Photoshop產品專家認證標準教材(CS6修訂版)
- 零基礎學會聲會影2018(全視頻教學版)
- 中文版Photoshop CS6經典自學教程
- Spark Cookbook 中文版
- CorelDRAW X6平面設計與制作案例教程
- FLUENT 15.0流場分析實戰指南
- 中文版Photoshop 2020基礎培訓教程
- 新手學UG NX 8.0輔助設計