I'm trying to get the page title working...I've tried to incorporate the suggested code into my template.php file. I get no errors, but the page title I've defined doesn't show up either...
<?php
function _phptemplate_variables($hook, $variables) {
// 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) {
$variables[$region] = theme('blocks', $region);
}
if ($hook == 'page') {
$variables['head_title'] = page_title_page_get_title();
}
}
return $variables;
}
?>
Comments
Comment #1
niklp commentedComment #2
piggybank commentedWell, I'm pleased to say I found the problem...it was with my code and how I incorporated the page_title into the already existing _phptemplate_variables() function.
Here's my updated code that IS working:
This is an example of how to incorporate the necessary code for page_title into your template.php file when there's already an existing function _phptemplate_.
Thanks,
Scott Gingrich
Comment #3
Jolla00 commentedI've spent several hours trying to get this page title module to work. The object of this is to be able to set all my page titles individually when I create the content. I hope this is the easiest way of achieving this.
Anyway, with my template came no template.php file so I used the one included. When the template.php file has been uploaded to the server and I try to reach my drupal installation from a web browser this is all that I get:
Fatal error: Cannot redeclare _phptemplate_variables() (previously declared in /mounted-storage/home16a/sub001/sc18002-DHRZ/www/Joel/sparportalen.se/drupal/themes/arcmateria/template.php:2) in /mounted-storage/home16a/sub001/sc18002-DHRZ/www/Joel/sparportalen.se/drupal/themes/arcmateria/page.tpl.php on line 6
I can't understand where _phptemplate_variables() can have been declared before. Is the script looping?
I would really appreciate help with this!
Comment #4
niklp commentedThat seems strange to me, although I'm no expert...
I don't *believe* that any declaration of that function in your theme would cause that error, unless it is already declared somewhere in your theme. Have you checked through the template.php file for existing declarations of the function? There is frequently one already in existence. If not you could check the other files, but it seems unlikely...
Sorry if this isn't helpful.
Comment #5
johnalbinFrom your error message, you have declared
_phptemplate_variables()in both template.php and page.tpl.php. Remove the declaration from page.tpl.php.Comment #6
dries commentedComment #7
yogayak commentedI 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.
/**
* 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();
}
Comment #8
johnalbinHi Michel,
This is the bug reporting queue of the page_title module. If you need support on your template.php file, please head over to the support forums: http://drupal.org/forum/3
- John
Comment #9
yogayak commentedI've posted my Garland problem to http://drupal.org/node/152839
John, did I not post to the Issues category not the bugs? If all Garland users have this problem I would consider it an issue. But I trust your judgement.
Comment #10
gurukripa commentedI want this to work with book pages and other pages too..is this possible for things like Story/blog also ?
I tried making this work..by adding in my template.php but it doesnt happen. I am using Fancy theme with Drupal 5.1
Here's the template.php Kindly help me with the corrected code for this. Thanks.
Comment #11
gurukripa commentedsorry forgot to make it active...and just checked and found that i am using 5.x-1.1
kindly advise
thanks
Comment #12
johnalbinMahaprabhu, in Fancy theme’s template.php file, find the
_phptemplate_variables()function and add the following lines just beforereturn $variables;.Comment #13
nicholasthompsonClosed due to inactivity...
Comment #14
(not verified) commented