The theme I am using (Green'N'Black) has multiple php files (page, node, template, etc.) and I cannot find the preprocess_page. Perhaps I am looking in the wrong place. Is it in a Drupal 5 php file. Please advise? Thank you.

Comments

toemaz’s picture

Good question. I use the zen theme a lot to do my theming and perhaps I made a mistake by assuming that the yourtheme_preprocess_page(&$vars) is in all themes available. My mistake.

For Drupal 5 & phptemplate based themes, you need to adjust or insert _phptemplate_variables function into your theme template.php file.

Could you test this?

If you succeed, I will adjust the install instructions for this module.

LynnLubell’s picture

I've had a lot of drupal brain damage today (pathauto bulk update) and would appreciate it very much if you could show me where to make the modification. The template.php file is below. Thanks!
------------------------------------------------------------------------------------
application/x-httpd-php template.php
PHP script text




/**
* IE detector
*/
function greenNblack_ie_detect()
{
    if (isset($_SERVER['HTTP_USER_AGENT']) && 
    (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
        return true;
    else
        return false;
}

/**
* Add pngFix script to fix .png transparensy bug in IE6
*/

if (greenNblack_ie_detect()){
drupal_add_js(drupal_get_path('theme', 'greenNblack') . '/js/jquery.pngFix.js', 'theme');
}

/**
 * Sets the body-tag class attribute.
 *
 * Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
 */
function greenNblack_container($L, $R) {

$class ='container';
    if ($L) {
      $class .= ' container-left';
    }
    if ($R) {
      $class .= ' container-right';
    }
 
 
    return ' class="'. $class .'"';
  
}

function greenNblack_footer($message){
$message.='<div id="author_link"> ';
return $message;
}

/**
* Declare own regiong in template
*/
function greenNblack_regions() {
  return array(
    'sidebar_right' => t('right sidebar'),
	'sidebar_left' => t('left sidebar'),
	'sub_header' => t('sub header'),
	'top_content' => t('content above nodes'),
	'content' => t('content'),
    'header' => t('header'),
	'top_menu' => t('top menu'),
    'footer' => t('footer')
	
  );
}

/**
* Altering search form
*/

function phptemplate_search_theme_form($form) {
$form['#prefix']='<div id="search" class="container-inline">';
$form['#suffix']='</div>';
unset ($form['submit']);
 
$form['search_theme_form_keys']['#title'] = t('Search');
 
return drupal_render($form);
}
LynnLubell’s picture

Perhaps it's in this file?

application/x-httpd-php page.tpl.php
HTML document text


print $language " xml:lang=" print $language ">

print $head_title
print $head print $styles print $scripts

 if (greenNblack_ie_detect()){ 
/**
*this block will be returned for IE browsers only. Implemented to clean up the code for decent browsers
**/
@import " print base_path() . path_to_theme() /ie6-fix.css"; $(document).ready(function(){ $(document).pngFix(); });


}

print $header;
print $sub_header print $search_box
print greenNblack_container($sidebar_left, $sidebar_right); >
print $breadcrumb
if ($content_top) { print $content_top; }
if ($title) { print $title

}
if ($tabs) {

print $tabs

}
print $help print $messages print $top_content; print $content;

if ($sidebar_left) {

print $sidebar_left;

}
if ($sidebar_right) {

}

print $closure


toemaz’s picture

Be carefull you don't pass on your brain damage to me with throwing all this php code ;-)

Could you add the following function into your template.php file:

function _phptemplate_variables($hook, $vars) {
  if ($hook == 'page') {

    if (module_exists('google_admanager')) {
      $vars['scripts'] .= google_admanager_add_js();
    }

    return $vars;
  }
  return array();
}
LynnLubell’s picture

sorry about that & thanks a million. is there a particular place to ad it? thank you!!

toemaz’s picture

Status: Active » Fixed

So I may presume it worked of for you? If not, please let me know. In the meantime I put the issue on fixed.

LynnLubell’s picture

I haven't tried it yet. I was hoping to hear back from you on where to place it within the file. Thanks.

toemaz’s picture

Hi Lynn,

There is no specific place to put this in. Anyway, you can try these things and see whether php crashes or not. If so, just restore the file. Don't be afraid of playing a bit with the code.

LynnLubell’s picture

Thanks for your help but I am not there yet. I was able to add the php code without a problem. And I added & enabled the module and input the ad slot I created with admanager and my adsense code. However, when I try to view the blocks I get a white screen. I tried to increase memory but that did not work. What do you suggest? Thank you.

toemaz’s picture

I propose you look into the webserver (e.g. apache) error log files or ask professional help from a Drupal coder.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.