Настройка title page в Друпал 5 - нужна помощь

S
На сайте с 20.10.2009
Offline
87
637

Всем привет! Раньше с Друпал никогда не работал, но тут возникла проблема, необходимо, чтобы коректно функционировал плагин title page. Его установил и активировал, но нужно в файле template.php прописать код

<?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;
}
?>

куда его прописывать я не знаю - в php не силен, вот файл template.php:

<?php

// $Id: template.php,v 1.4.2.1 2007/04/18 03:38:59 drumm Exp $

/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($sidebar_left, $sidebar_right) {
if ($sidebar_left != '' && $sidebar_right != '') {
$class = 'sidebars';
}
else {
if ($sidebar_left != '') {
$class = 'sidebar-left';
}
if ($sidebar_right != '') {
$class = 'sidebar-right';
}
}

if (isset($class)) {
print ' class="'. $class .'"';
}
}

/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
}
}

/**
* Allow themable wrapping of all comments.
*/
function phptemplate_comment_wrapper($content, $type = null) {
static $node_type;
if (isset($type)) $node_type = $type;

if (!$content || $node_type == 'forum') {
return '<div id="comments">'. $content . '</div>';
}
else {
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
}
}

/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {

if ($secondary = menu_secondary_local_tasks()) {
$output = '<span class="clear"></span>';
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
$vars['tabs2'] = $output;
}

// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
return $vars;
}
return array();
}

/**
* Returns the rendered local tasks. The default implementation renders
* them as tabs.
*
* @ingroup themeable
*/
function phptemplate_menu_local_tasks() {
$output = '';

if ($primary = menu_primary_local_tasks()) {
$output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
}

return $output;
}

Заранее благодарен за помощь.

F
На сайте с 03.10.2006
Offline
160
#1

Это код для вашего template.php. Просто замените старый код приведённым мной. Если не будет работать, то отпишите, поправлю.


<?php
// $Id: template.php,v 1.4.2.1 2007/04/18 03:38:59 drumm Exp $

/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($sidebar_left, $sidebar_right) {
if ($sidebar_left != '' && $sidebar_right != '') {
$class = 'sidebars';
}
else {
if ($sidebar_left != '') {
$class = 'sidebar-left';
}
if ($sidebar_right != '') {
$class = 'sidebar-right';
}
}

if (isset($class)) {
print ' class="'. $class .'"';
}
}

/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
}
}

/**
* Allow themable wrapping of all comments.
*/
function phptemplate_comment_wrapper($content, $type = null) {
static $node_type;
if (isset($type)) $node_type = $type;

if (!$content || $node_type == 'forum') {
return '<div id="comments">'. $content . '</div>';
}
else {
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
}
}

/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {

if ($secondary = menu_secondary_local_tasks()) {
$output = '<span class="clear"></span>';
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
$vars['tabs2'] = $output;
}

// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}

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

return $vars;
}
return array();
}

/**
* Returns the rendered local tasks. The default implementation renders
* them as tabs.
*
* @ingroup themeable
*/
function phptemplate_menu_local_tasks() {
$output = '';

if ($primary = menu_primary_local_tasks()) {
$output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
}

return $output;
}
S
На сайте с 20.10.2009
Offline
87
#2

спасибо вам! Вопрос решен!

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий