Step 1: Installation

Last modified: May 5, 2008 - 18:42

Page Title for Drupal 5 will install with minor modifications to your theme. Page Title for Drupal 6 will install much more easily and requires no modification to your theme.

The Quick Version

  1. Install the module as per usual (unzip in sites/all/modules or somewhere)
  2. Enable the module via Drupal (in Administer > Build > Modules)
  3. If Drupal 5, configure your theme's template.php function
  4. Configure Page Title
  5. Enable Page Title in your theme

The Long Version

Some of the steps above have additional information provided in this section.

If the module won't enable

When you enable the module, the Drupal install system will attempt to create the database table page_title. You should see a message confirming success or proclaiming failure. If the database table creation did not succeed, you will need to manually add the following table definition to your database:

    CREATE TABLE `page_title` (
      `nid` INT NOT NULL ,
      `page_title` VARCHAR( 128 ) NOT NULL ,
      PRIMARY KEY ( `nid` )
    ) /*!40100 DEFAULT CHARACTER SET utf8 */;

Drupal 5

In Drupal 5 there is, unfortunately, no way for a module to directly modify the contents of the PAGE itself - in this case the page title is handled by Drupal core.

To let your PHPTemplate based theme interact with this module, you need to add some code to the template.php file that comes with your theme. If there is no template.php file, you can simply use the one included with this download:

<?php
function _phptemplate_variables($hook, $vars) {
 
$vars = array();
  if (
$hook == 'page') {

   
// These are the only important lines
   
if (module_exists('page_title')) {
     
$vars['head_title'] = page_title_page_get_title();
    }

  }
  return
$vars;
}
?>

As you can see from the code comment, there are only three important lines of code:

<?php
 
if (module_exists('page_title')) {
   
$vars['head_title'] = page_title_page_get_title();
  }
?>

These lines need to be added to the 'page' hook of the _phptemplate_variables function.

Drupal 6

Thanks to the new theme preprocessing functions built into Drupal 6, Page Title can now be installed without any modification to the theme whatsoever. This is good!

This is included in the Zen theme for Drupal 5

alienresident - February 4, 2009 - 17:32

Note: You do not have to add to add this to your template.php if you are using a Zen subtheme. The Zen theme will work with this module automatically.

Additional Info:
http://drupal.org/node/267873
Zen theme homepage:
http://drupal.org/project/zen

if you are using a *new* install of zen

Jerimee - March 16, 2009 - 23:57

my zen template.php is v 1.12.2.16 2007/11/06 08:13:53

I didn't find the code in template.php - so I'm going to assume I still need to add it

 
 

Drupal is a registered trademark of Dries Buytaert.