Commit 1f41c7f8 authored by JohnAlbin's avatar JohnAlbin
Browse files

Updated files from 5.x branch.

parent 12a03814
Page Title 5.x-1.1
* Added Russian translation by SadhooKlay.
* Removed inaccurate package description from .info file.
Page Title 5.x-1.0
* Initial release.
********************************************************************
D R U P A L M O D U L E
P A G E T I T L E M O D U L E
********************************************************************
Name: Page title module
Version: 0.1
Author: Robert Douglass
Email: rob ad robshouse dot net
Last update: February 21, 2006
Drupal: 4.7
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 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.
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.
********************************************************************
PERMISSIONS:
This module defines the "set page title" permission. This permission determines
whether a user will se the "Page title" field on node edit forms.
********************************************************************
SYSTEM REQUIREMENTS:
Drupal: 4.7
This module defines the "set page title" permission. This permission
determines whether a user will see the "Page title" field on node edit forms.
********************************************************************
INSTALLATION:
1. Place the entire page_title directory into your Drupal modules/
directory.
2. Enable this module by navigating to:
administer > 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` )
) TYPE = MYISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
) /*!40100 DEFAULT CHARACTER SET utf8 */;
3. Optionally configure the two variations of page title by visiting:
administer > settings > page_title
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
......@@ -62,21 +53,25 @@ INSTALLATION:
function _phptemplate_variables($hook, $vars) {
$vars = array();
if ($hook == 'page') {
// This is the only important line
$vars['head_title'] = page_title_page_get_title();
// 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 is only one important line
As you can see from the code comment, there are only three important lines
of code:
$vars['head_title'] = page_title_page_get_title();
This line needs to be added to the 'page' hook of the _phptemplate_variables
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.
\ No newline at end of file
; $Id$
name = Page Title
description = "Enhanced control over the page title (in the <head> tag)."
package = Content
<?php
// $Id$
function page_title_install() {
switch ($GLOBALS['db_type']) {
......@@ -10,8 +11,8 @@ function page_title_install() {
PRIMARY KEY ( `nid` )
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
if ($query1) {
$created = TRUE;
}
$created = TRUE;
}
break;
case 'pgsql':
......@@ -20,8 +21,8 @@ function page_title_install() {
page_title text NOT NULL default ''
);");
if ($query1) {
$created = TRUE;
}
$created = TRUE;
}
break;
}
......
<?php
// $Id$
/**
* @file
* Enhanced control over the page title (in the head tag).
*
* 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.
*/
define(MODULE_DESCRIPTION, 'Enhanced control over the page title (in the &lt;head&gt; tag).');
function page_title_help($section) {
switch ($section) {
case 'admin/modules#description':
$output = t(MODULE_DESCRIPTION);
$output = t('Enhanced control over the page title (in the &lt;head&gt; tag).');
break;
case 'admin/help#page_title':
$output = t('<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p>
......@@ -23,7 +25,7 @@ function page_title_help($section) {
<ol><li><em>page title</em> | <em>site name</em></li>
<li><em>site name</em> | <em>site slogan</em></li></ol>
<p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p>
<p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>@page_title</code> placeholder. If left blank, <code>@page_title</code> will be the node's title, as is now the case.</p>");
<p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>!page_title</code> placeholder. If left blank, <code>!page_title</code> will be the node's title, as is now the case.</p>");
break;
}
return $output;
......@@ -44,7 +46,7 @@ function page_title_menu($may_cache) {
$items[] = array(
'path' => 'admin/settings/page_title',
'title' => t('Page title'),
'description' => t(MODULE_DESCRIPTION),
'description' => t('Enhanced control over the page title (in the &lt;head&gt; tag).'),
'callback' => 'drupal_get_form',
'callback arguments' => 'page_title_admin_settings',
'access' => user_access('administer site configuration'),
......@@ -62,16 +64,16 @@ function page_title_admin_settings() {
$form['page_title']['page_title_individual'] = array(
'#type' => 'textfield',
'#title' => t('Pattern for individual pages'),
'#default_value' => variable_get('page_title_individual', '@page_title | @site_name'),
'#default_value' => variable_get('page_title_individual', '!page_title | !site_name'),
'#maxlength' => 128,
'#description' => t('Available placeholders: <code>@page_title</code>, <code>@site_name</code>, <code>@site_slogan</code>.'),
'#description' => t('Available placeholders: <code>!page_title</code>, <code>!site_name</code>, <code>!site_slogan</code>.'),
);
$form['page_title']['page_title_front'] = array(
'#type' => 'textfield',
'#title' => t('Pattern for front page'),
'#default_value' => variable_get('page_title_front', '@site_name | @site_slogan'),
'#default_value' => variable_get('page_title_front', '!site_name | !site_slogan'),
'#maxlength' => 128,
'#description' => t('Available placeholders: <code>@site_name</code>, <code>@site_slogan</code>.'),
'#description' => t('Available placeholders: <code>!site_name</code>, <code>!site_slogan</code>.'),
);
return system_settings_form($form);
}
......@@ -148,23 +150,28 @@ function page_title_node_get_title($nid) {
* the page hook of function _phptemplate_variables in template.php.
*/
function page_title_page_get_title() {
$page_title_individual = variable_get('page_title_individual', '@page_title | @site_name');
$page_title_front = variable_get('page_title_front', '@site_name | @site_slogan');
static $title = NULL;
// this is the normal title. For node pages it is $node->title
$drupal_title = drupal_get_title();
if (is_null($title)) {
$page_title_individual = variable_get('page_title_individual', '!page_title | !site_name');
$page_title_front = variable_get('page_title_front', '!site_name | !site_slogan');
// this is the custom page title. For node pages it is $node->page_title.
$page_title = (page_title_set_title()) ? strip_tags(page_title_set_title()) : $drupal_title;
// this is the normal title. For node pages it is $node->title
$drupal_title = drupal_get_title();
$site_name = variable_get('site_name', 'drupal');
$site_slogan = variable_get('site_slogan', '');
// this is the custom page title. For node pages it is $node->page_title.
$page_title = (page_title_set_title()) ? page_title_set_title() : $drupal_title;
$page_title = strip_tags($page_title);
if ($drupal_title) {
$title = t($page_title_individual, array('@page_title' => $page_title, '@site_name' => $site_name, '@site_slogan' => $site_slogan));
}
else {
$title = t($page_title_front, array('@site_name' => $site_name, '@site_slogan' => $site_slogan));
$site_name = variable_get('site_name', 'drupal');
$site_slogan = variable_get('site_slogan', '');
if (drupal_is_front_page() || !$drupal_title) {
$title = t($page_title_front, array('!site_name' => $site_name, '!site_slogan' => $site_slogan));
}
else {
$title = t($page_title_individual, array('!page_title' => $page_title, '!site_name' => $site_name, '!site_slogan' => $site_slogan));
}
}
return $title;
}
# $Id$
#
# LANGUAGE translation of Drupal (page_title.module)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from files:
# page_title.install,v 1.2.2.1 2007/07/10 07:19:49 johnalbin
# page_title.info,v 1.1.2.1 2007/06/20 13:32:02 robertDouglass
# page_title.module,v 1.2.2.5 2007/07/10 07:58:02 johnalbin
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2007-07-10 02:29-0700\n"
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
"Last-Translator: NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: page_title.install:30
msgid "Page title module installed successfully."
msgstr ""
#: page_title.install:33
msgid "Table installation for the Page title module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries."
msgstr ""
#: page_title.info:0
msgid "Page Title"
msgstr ""
#: page_title.info:0
msgid "Enhanced control over the page title (in the &lt;head> tag)."
msgstr ""
#: page_title.module:17;49
msgid "Enhanced control over the page title (in the &lt;head&gt; tag)."
msgstr ""
#: page_title.module:20
msgid "<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p>\n <p>Allows for better global configuration of the page title.</p>"
msgstr ""
#: page_title.module:24
msgid "<p>The default page title follows one of two patterns:\n <ol><li><em>page title</em> | <em>site name</em></li>\n <li><em>site name</em> | <em>site slogan</em></li></ol>\n <p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p>\n <p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>!page_title</code> placeholder. If left blank, <code>!page_title</code> will be the node's title, as is now the case.</p>"
msgstr ""
#: page_title.module:48;85
msgid "Page title"
msgstr ""
#: page_title.module:62
msgid "Page title templates"
msgstr ""
#: page_title.module:66
msgid "Pattern for individual pages"
msgstr ""
#: page_title.module:69
msgid "Available placeholders: <code>!page_title</code>, <code>!site_name</code>, <code>!site_slogan</code>."
msgstr ""
#: page_title.module:73
msgid "Pattern for front page"
msgstr ""
#: page_title.module:76
msgid "Available placeholders: <code>!site_name</code>, <code>!site_slogan</code>."
msgstr ""
#: page_title.module:38
msgid "set page title"
msgstr ""
#: page_title.module:0
msgid "page_title"
msgstr ""
......@@ -13,11 +13,11 @@ msgstr ""
"X-Poedit-Country: RUSSIAN FEDERATION\n"
"X-Poedit-SourceCharset: utf-8\n"
#: page_title.install:29
#: page_title.install:30
msgid "Page title module installed successfully."
msgstr "Модуль Page Title установлен успешно."
#: page_title.install:32
#: page_title.install:33
msgid "Table installation for the Page title module was unsuccessful. The tables may need to be installed by hand. See the README.txt file for a list of the installation queries."
msgstr "Создание таблицы в базе данных для модуля Page Title не увенчалось успехом. Таблицы должны быть созданы в ручную. Просмотрите сценарии установки в файле README.txt ."
......@@ -29,60 +29,43 @@ msgstr "Заголовки страниц"
msgid "Enhanced control over the page title (in the &lt;head> tag)."
msgstr "Расширенное управление заголовком страницы (тэг &lt;title> в &lt;head>)"
#: page_title.info:0
msgid "Content"
msgstr "Содержание"
#: page_title.module:10
#: page_title.module:17;49
msgid "Enhanced control over the page title (in the &lt;head&gt; tag)."
msgstr "Расширенное управление заголовком страницы (тэг &lt;title> в &lt;head>)"
#: page_title.module:18
msgid ""
"<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p>\n"
" <p>Allows for better global configuration of the page title.</p>"
#: page_title.module:20
msgid "<p>Adds an extra form element to node creation forms that allows you to specify the page title.</p>\n <p>Allows for better global configuration of the page title.</p>"
msgstr "Добавляет расширение при создании / редактирования материала в виде формы позволяющей дать странице специфичный заголовок. Позволяет улучшить глобальные настройки заголовков страниц."
#: page_title.module:22
msgid ""
"<p>The default page title follows one of two patterns:\n"
" <ol><li><em>page title</em> | <em>site name</em></li>\n"
" <li><em>site name</em> | <em>site slogan</em></li></ol>\n"
" <p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p>\n"
" <p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>@page_title</code> placeholder. If left blank, <code>@page_title</code> will be the node's title, as is now the case.</p>"
msgstr ""
"<p>Заголовки страниц по умолчанию назначаются по одной из двух схем:\n"
" <ol><li><em>Заголовок страницы</em> | <em>Название сайта</em></li>\n"
" <li><em>Название сайта</em> | <em>Слоган сайта</em></li></ol>\n"
"<p>#1 - общий случай, когда посетитель просматривает какие то конкретные страницы</p><p>#2 - используется по умолчанию по крайней мере на главной странице (<em>материала</em>)</p>\n"
"<p>Модуль page_title.module позволяет менять эти значения двумя способами. Во-первых, вы можете настроить показ этих заголовков с помощью шаблонов приведенных ниже. Этот способ изменит заголовок страницы созданный по умолчанию. Во вторых, при создании материала у вас присутствует форма, где вы можете ввести название которое будет отображаться в заголовке страницы при просмотре этого материала. Если значение которое вы введете в поле редактирования шаблонов, предоставляется материалом оно может быть использовано для генерации заголовка страницы. Если левая часть шаблона пуста, в качестве заголовка страницы с материалом будет использовано значение по умолчанию.</p>"
#: page_title.module:46
#: ;83
#: page_title.module:24
msgid "<p>The default page title follows one of two patterns:\n <ol><li><em>page title</em> | <em>site name</em></li>\n <li><em>site name</em> | <em>site slogan</em></li></ol>\n <p>#1 is the common case where the visitor is viewing a specific page whereas #2 is used at least for the default front page (<em>node</em>).</p>\n <p>The page_title.module lets you change these defaults in two ways. First, you can adjust the templates below using the placeholders given. This will change the way the default page titles are created. Second, on every node creation form, you can have the option of specifying a title that is different than the title of the node. If a value is provided, this will be used to generate the <code>!page_title</code> placeholder. If left blank, <code>!page_title</code> will be the node's title, as is now the case.</p>"
msgstr "<p>Заголовки страниц по умолчанию назначаются по одной из двух схем:\n <ol><li><em>Заголовок страницы</em> | <em>Название сайта</em></li>\n <li><em>Название сайта</em> | <em>Слоган сайта</em></li></ol>\n<p>#1 - общий случай, когда посетитель просматривает какие то конкретные страницы</p><p>#2 - используется по умолчанию по крайней мере на главной странице (<em>материала</em>)</p>\n<p>Модуль page_title.module позволяет менять эти значения двумя способами. Во-первых, вы можете настроить показ этих заголовков с помощью шаблонов приведенных ниже. Этот способ изменит заголовок страницы созданный по умолчанию. Во вторых, при создании материала у вас присутствует форма, где вы можете ввести название которое будет отображаться в заголовке страницы при просмотре этого материала. Если значение которое вы введете в поле редактирования шаблонов, предоставляется материалом оно может быть использовано для генерации заголовка страницы. Если левая часть шаблона пуста, в качестве заголовка страницы с материалом будет использовано значение по умолчанию.</p>"
#: page_title.module:48;85
msgid "Page title"
msgstr "Заголовки страниц"
#: page_title.module:60
#: page_title.module:62
msgid "Page title templates"
msgstr "Шаблоны заголовков страниц"
#: page_title.module:64
#: page_title.module:66
msgid "Pattern for individual pages"
msgstr "Шаблон для отдельных страниц"
#: page_title.module:67
#: page_title.module:69
msgid "Available placeholders: <code>@page_title</code>, <code>@site_name</code>, <code>@site_slogan</code>."
msgstr "Доступные шаблоны: <code>@page_title</code>, <code>@site_name</code>, <code>@site_slogan</code>."
#: page_title.module:71
#: page_title.module:73
msgid "Pattern for front page"
msgstr "Шаблон для главной страницы"
#: page_title.module:74
#: page_title.module:76
msgid "Available placeholders: <code>@site_name</code>, <code>@site_slogan</code>."
msgstr "Доступные шаблоны: <code>@site_name</code>, <code>@site_slogan</code>."
#: page_title.module:36
#: page_title.module:38
msgid "set page title"
msgstr "устанавливать заголовки страницам"
......
......@@ -3,9 +3,9 @@
function _phptemplate_variables($hook, $vars) {
$vars = array();
if ($hook == 'page') {
if (module_exist('page_title')) {
if (module_exists('page_title')) {
$vars['head_title'] = page_title_page_get_title();
}
}
}
return $vars;
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment