Drupal,在那里我可以找到页脚文件


Drupal, where i can find footer file?

我需要在drupal上的网站中放入一些代码,我需要这些代码来处理我网站的每一页。我该怎么做?我想找到页脚的文件并在里面放一些代码,但我找不到。

有三种方法可以将PHP代码添加到页脚中。

1> 打开PHP过滤器&将代码输入到位于页脚左侧区域的块中
2> 将代码放入子主题中相应的模板文件
3> 制作一个模块,将代码输出到块激活并放置块

假设您想在页脚区域添加以下行:

&copy;<?php print date('Y');?> Your Company Name - Address of your company.

所以最好的方法是制作这样的小模块:

copyright_block.info

name = Copyright Block
description = Shows the (incrementing) current year and company information.
package = Other
core = 7.x
files[] = copyright_block.module

copyright_block.module

<?php
/**
* @file
* This module shows the copyright year and company information.
*/
/**
* Implements hook_help().
*/
function copyright_block_help($path, $arg) {
  if ($path == 'admin/help#copyright_block') {
    return t('Manually edit to change company information');
  }
}
/**
* Implements hook_block_info().
*/
function copyright_block_block_info() {
  $blocks = array();
  $blocks['show_copyright'] = array(
    'info' => t('Company Information'),
    'cache' => DRUPAL_NO_CACHE,
  );
  return $blocks;
}
/**
* Implements hook_block_view().
*/
function copyright_block_block_view($block_name = '') {
  if ($block_name == 'show_copyright') {
$content = "<p>&copy;" . date('Y') ." Your Company Name - Address of your company</p>";
    $block = array(
      'subject' => t('Company Information'),
      'content' => $content,
    );
    return $block;
  }
}

注意:不要在末尾放置PHP结束标记?>