- Drupal 6 Theming Cookbook
- Karthik Kumar
- 362字
- 2021-04-13 16:56:43
We will be covering the following recipes in this chapter:
- Understanding the anatomy of a theme
- Creating a sub-theme based on a core theme
- Overriding base theme elements in a sub-theme
- Changing the screenshot image of a theme
- Including a CSS file in a theme
- Enabling CSS optimization
- Creating the mysite module to hold our tweaks
- Adding a CSS file from a module
- Displaying a different theme for each day of the week
- Creating a fresh look using the color module
One of the more prevalent adages with respect to Drupal development and theming is:
Do not hack core!
Modules, themes, and other files which come with a stock Drupal installation should never be edited directly. In other words, we really should not need to modify anything outside the sites
folder which is designed to contain all our changes and customizations. The reasoning behind this is that most, if not all, aspects of core are accessible and modifiable through a clean and non-invasive process using Drupal's APIs. Therefore, hacking core modules and themes to get things done is almost always unnecessary and ill-advised.
Another reason why directly editing core modules and themes, or for that matter, even contributed modules and themes, is that whenever an upgrade of Drupal or said modules and themes takes place, we will very likely be overwriting the changes we have made, or at the very least, make the upgrade a trying exercise.
With respect to themes, let us take the example of a core theme such as Garland. As previously mentioned, it is a poor practice to edit the theme directly. The Drupal way is to extend the existing core theme using a sub-theme which, by default, is more or less an identical copy. This sub-theme can then be extended further and customized by overriding elements of the base theme,such as its stylesheets, template files, template variables, and so on.
In this chapter, we will look at the building blocks of a basic theme and then familiarize ourselves with the concept of the sub-theme and the various techniques available to extend, override and modify it according to our requirements.
- 持續演進的Cloud Native:云原生架構下微服務最佳實踐
- 中文版After Effects CC實用教程
- Drupal Multimedia
- Puppet 2.7 Cookbook
- 照相館的故事:Photoshop CC 2018調色合成精修
- Cinema 4D電商美工與視覺設計案例教程(培訓教材版)
- ASP.NET jQuery Cookbook
- 快學熟用D3
- 中文版Premiere Pro CS6視頻編輯(慕課版)
- Deep Inside osCommerce: The Cookbook
- 從零開始:Photoshop CS6中文版基礎培訓教程
- SilverStripe 2.4 Module Extension, Themes, and Widgets: Beginner's Guide
- 選擇的藝術:Photoshop圖像處理深度剖析(第3版)
- Illustrator 2024實用教程
- Midjourney AI生圖與修圖從入門到精通