I am using the garland theme and have tried many different locations for the link_page code to go into. But I keep gettings errors. The code looks different than the above. Can anybody spot where I should insert the code? I'm onling posting part of the template file as it is quite large.

This is working code posted on: http://drupal.org/node/117123

function _phptemplate_variables($hook, $vars) {
  // Load the node region only if we're not in a teaser view.
  if ($hook == 'node' && !$vars['teaser']) {
    // Load region content assigned via blocks.
    foreach (array('inline1') as $region) {
          $vars[$region] = theme('blocks', $region);
    }
    }
  if ($hook == 'page') {
        $vars['head_title'] = page_title_page_get_title();
  }
  return $vars;
}

************

This is my un altered code:

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

if ($secondary = menu_secondary_local_tasks()) {
$output = '';
$output .= "

\n". $secondary ."

\n";
$vars['tabs2'] = $output;
}

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

Has any other Garland user been able to incorporate the Page Title Module into this php, if so, can you share how?

Love and light

I first posted this post at http://drupal.org/project/issues/page_title?categories=support&states=all but was told to post it here.

Comments

johnalbin’s picture

Hi Michel,

I guess this is Page Title related. Sorry, I was confused because you were originally talking about the “link_page code.” link_page? What’s that?

Anyway, the code you want to use in your template.php file is:

<?php
function _phptemplate_variables($hook, $vars) {
  // Load the node region only if we're not in a teaser view.
  if ($hook == 'node' && !$vars['teaser']) {
    // Load region content assigned via blocks.
    foreach (array('inline1') as $region) {
      $vars[$region] = theme('blocks', $region);
    }
  }
  if ($hook == 'page') {
    if (module_exists('page_title')) {
      $vars['head_title'] = page_title_page_get_title();
    }
  }
  return $vars;
}
?>

  - John

Albin.Net : friendly web development

  - John (JohnAlbin)

yogayak’s picture

Hi John,

Newbie question,

Where do I insert that? I don't think I add the opening and closing right?

Sorry for the long post, but here is my template:

<?php
/**
* 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 '

';
}
}

/**
* 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 '

'. $content . '

';
}
else {
return '

'. t('Comments') .'

'. $content .'

';
}
}

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

if ($secondary = menu_secondary_local_tasks()) {
$output = '';
$output .= "

    \n". $secondary ."

\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 .= "

    \n". $primary ."

\n";
}

return $output;
}

(it really does end like that!)

yogayak’s picture

the working template looks like this

/**
* Override or insert PHPTemplate variables into the templates.
*/

function _phptemplate_variables($hook, $vars) {
// Load the node region only if we're not in a teaser view.
if ($hook == 'node' && !$vars['teaser']) {
// Load region content assigned via blocks.
foreach (array('inline1') as $region) {
$vars[$region] = theme('blocks', $region);
}
}
if ($hook == 'page') {
if (module_exists('page_title')) {
$vars['head_title'] = page_title_page_get_title();
}

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

}
return $vars;
}