欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

覆写默认样式的各种方法

shiping1 的头像

覆写默认样式的各种方法

  除了利用CSS,还有多种方法可实现对Drupal默认样式的覆写。其中每一种方法各有利弊,因此你,作为主题开发人员,需要决定哪一种方法是最适合你的。

方法如下:

  • 代理模板 ex: maintenance-page.tpl.php    在themes/garland/maintenance-page.tpl.php(复制于modules/system/maintenance-page.tpl.php)
  • 覆写模板 ex: page-user-1.tpl.php     在themes/garland/page-user-1.tpl.php
  • 将函数覆写放入template.php文件  ex: function phptemplate_breadcrumb ($breadcrumb) .....    在themes/garland/template.php
  • 用专用模板文件覆写主题函数   ex: themes/garland/breadcrumb.tpl.php 覆写 function theme_breadcrumb 在includes/theme.inc

在接下来的几节中,我们将一一介绍。


主题登记簿(The Theme Registry)

Drupal的主题登记簿告诉系统有哪些可用的函数和模板。当你添加或者删除主题函数和模板时,你需要更新一下主题登记簿(如果只是编辑原有的函数或模板,就不用更新了)。

更新登记簿:

1、访问 Administer | Site configuration | Performance

2、选择 Clear cached data

这是一个不能省略的重要步骤,否则你就不能看到你的修改(有时你甚至会看到错误信息提示)。
来自 http://drupaling.org/node/622

普通分类: