I'd like to add the following code to a block that will be shown in the footer left area:

&copy;<?php print date('Y');?> Company Name - 123 Main St - Anywhere, NY 10101

There are 3 ways that I can think of doing it:

  1. turn on the php filter & enter the code into a block that is positioned in the footer left region.
  2. Put the code in the appropriate template file in the sub-theme.
  3. Make a module that outputs the code to a block; activate and place the block.

Since #1 involved the php filter, it is a security risk. And #3 seems like overkill.

I've done method #2 when I've used another starter theme (zen, basic) as the specific code for rendering the block was easy to locate and replace.

But where do I find the code that outputs the left footer region, without affecting the output of the right footer region?

The template section--footer.tpl.php only contains code for rendering the entire region.

<footer<?php print $attributes; ?>>
  <?php print $content; ?>
</footer>

Where would i find the code that would allow me to customize a mythical file "section--footer_left.tpl.php" and over-ride its contents?

Comments

Lrrr’s picture

Answered my own question.... Solution #3....MODULE!

copyright_block.info

;$Id$
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') ." Mega Corp, Inc; 123 Main St; Suite 1010; Anytown, NY 10101</p>";
    $block = array(
      'subject' => t('Company Information'),
      'content' => $content,
    );
    return $block;
  }
}

Note: block has a subject that is in the code for screen readers, but suppressed for others with CSS.

fubhy’s picture

Status:Active» Fixed

Cool

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.