You are here

README.txt in Page Title 7

********************************************************************
                P A G E    T I T L E    M O D U L E
********************************************************************
Original Author: Robert Douglass
Current Maintainers: Nicholas Thompson and John Wilkins

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

   This module gives you control over the page title. It gives you the chance
   to provide patterns 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.

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

   This module defines the "set page title" and "administer page titles"
   permissions. The "set page title" permission determines whether a user will
   be able to edit the "Page title" field on node edit forms (if visible.) The
   "administer page titles" permission determines whether a user will be able to
   edit the "Page title" administration pages.

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

1. Place the entire page_title directory into your Drupal modules/
   directory or the sites modules directory (eg site/default/modules)


2. Enable this module by navigating to:

     Administer > Build > Modules

   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:

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

3. Optionally configure the two variations of page title by visiting:

    Administer > Content management > Page titles

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') {

    // 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.

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

File

README.txt
View source
  1. ********************************************************************
  2. P A G E T I T L E M O D U L E
  3. ********************************************************************
  4. Original Author: Robert Douglass
  5. Current Maintainers: Nicholas Thompson and John Wilkins
  6. ********************************************************************
  7. DESCRIPTION:
  8. This module gives you control over the page title. It gives you the chance
  9. to provide patterns for how the title should be structured, and on node
  10. pages, gives you the chance to specify the page title rather than defaulting
  11. to the node title.
  12. ********************************************************************
  13. PERMISSIONS:
  14. This module defines the "set page title" and "administer page titles"
  15. permissions. The "set page title" permission determines whether a user will
  16. be able to edit the "Page title" field on node edit forms (if visible.) The
  17. "administer page titles" permission determines whether a user will be able to
  18. edit the "Page title" administration pages.
  19. ********************************************************************
  20. INSTALLATION:
  21. 1. Place the entire page_title directory into your Drupal modules/
  22. directory or the sites modules directory (eg site/default/modules)
  23. 2. Enable this module by navigating to:
  24. Administer > Build > Modules
  25. At this point the Drupal install system will attempt to create the database
  26. table page_title. You should see a message confirming success or
  27. proclaiming failure. If the database table creation did not succeed,
  28. you will need to manually add the following table definition to your
  29. database:
  30. CREATE TABLE `page_title` (
  31. `nid` INT NOT NULL ,
  32. `page_title` VARCHAR( 128 ) NOT NULL ,
  33. PRIMARY KEY ( `nid` )
  34. ) /*!40100 DEFAULT CHARACTER SET utf8 */;
  35. 3. Optionally configure the two variations of page title by visiting:
  36. Administer > Content management > Page titles
  37. 4. The page title is ultimately set at the theme level. To let your PHPTemplate
  38. based theme interact with this module, you need to add some code to the template.php
  39. file that comes with your theme. If there is no template.php file, you can simply
  40. use the one included with this download. Here is the code:
  41. function _phptemplate_variables($hook, $vars) {
  42. $vars = array();
  43. if ($hook == 'page') {
  44. // These are the only important lines
  45. if (module_exists('page_title')) {
  46. $vars['head_title'] = page_title_page_get_title();
  47. }
  48. }
  49. return $vars;
  50. }
  51. As you can see from the code comment, there are only three important lines
  52. of code:
  53. if (module_exists('page_title')) {
  54. $vars['head_title'] = page_title_page_get_title();
  55. }
  56. These lines need to be added to the 'page' hook of the _phptemplate_variables
  57. function.
  58. Alternately, you can call page_title_page_get_title() from page.tpl.php
  59. directly at the place where the title tag is generated.