README.txt 2.61 KB
Newer Older
1
********************************************************************
JohnAlbin's avatar
JohnAlbin committed
2
                P A G E    T I T L E    M O D U L E
3
********************************************************************
JohnAlbin's avatar
JohnAlbin committed
4
5
Original Author: Robert Douglass
Current Maintainers: Nicholas Thompson and John Wilkins
6
7
8
9

********************************************************************
DESCRIPTION:

JohnAlbin's avatar
JohnAlbin committed
10
11
12
13
   This module gives you control over the page title. It gives you the chance
   to provide templates for how the title should be structured, and on node
   pages, gives you the chance to specify the page title rather than defaulting
   to the node title.
14
15
16
17

********************************************************************
PERMISSIONS:

JohnAlbin's avatar
JohnAlbin committed
18
19
   This module defines the "set page title" permission. This permission
   determines whether a user will see the "Page title" field on node edit forms.
20
21
22
23
24
25

********************************************************************
INSTALLATION:

1. Place the entire page_title directory into your Drupal modules/
   directory.
JohnAlbin's avatar
JohnAlbin committed
26

27
28
29
30

2. Enable this module by navigating to:

     administer > modules
JohnAlbin's avatar
JohnAlbin committed
31

32
33
34
35
36
   At this point 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:
JohnAlbin's avatar
JohnAlbin committed
37

38
39
40
41
    CREATE TABLE `page_title` (
      `nid` INT NOT NULL ,
      `page_title` VARCHAR( 128 ) NOT NULL ,
      PRIMARY KEY ( `nid` )
JohnAlbin's avatar
JohnAlbin committed
42
43
    ) /*!40100 DEFAULT CHARACTER SET utf8 */;

44
3. Optionally configure the two variations of page title by visiting:
JohnAlbin's avatar
JohnAlbin committed
45

46
    administer > settings > page_title
JohnAlbin's avatar
JohnAlbin committed
47

48
49
50
51
52
53
54
55
4. The page title is ultimately set at the theme level. 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. Here is the code:

function _phptemplate_variables($hook, $vars) {
  $vars = array();
  if ($hook == 'page') {
JohnAlbin's avatar
JohnAlbin committed
56
57
58
59
60
61

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

62
63
64
65
  }
  return $vars;
}

JohnAlbin's avatar
JohnAlbin committed
66
  As you can see from the code comment, there are only three important lines
67
  of code:
JohnAlbin's avatar
JohnAlbin committed
68
69
70
71
72
73

  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
74
  function.
JohnAlbin's avatar
JohnAlbin committed
75

76
77
  Alternately, you can call page_title_page_get_title() from page.tpl.php
  directly at the place where the title tag is generated.