How to install/enable
Since Drupal 6, Page Title has become very easy to install.
- Install the module as per usual (unzip in sites/all/modules or somewhere)
- Enable the module via Drupal (D6: Administer > Build > Modules - D7: Administer > Modules)
- Configure Page Title
Information
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` (
`type` varchar(15) NOT NULL default 'node',
`id` int(10) unsigned NOT NULL default '0',
`page_title` varchar(255) NOT NULL default '',
PRIMARY KEY (`type`,`id`)
);
Drupal 5
DRUPAL 5 IS NO LONGER SUPPORTED. THIS IS LEFT IN THE DOCUMENTATION FOR LEGACY PURPOSES ONLY.
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. However if your theme is based on Zen there is no need to add the following lines of code.
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:
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:
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 & 7
Thanks to the new theme preprocessing functions built into Drupal 6 and 7, Page Title can now be installed without any modification to the theme whatsoever.
Comments
This is included in the Zen theme for Drupal 5
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
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
Hi
I need to change the '/' separator into '-' if using [menu link title]
or
do you have any token for parent name?
Drupal 6 = really good
This works well with Drupal 6. It could have been a nice option to be able to change title when editing nodes directly but works great overall.