Help with theme_preprocessor function

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ctmattice1's picture

I building a subtheme for zen and have run into a issue I could use some assistance/ guidance on.

I kept wondering why the maintenance page kept rendering in the default drupal theme in D6 where in D5 I could get it to render under a modified zen theme I call oldzen. In searching for the answer I found out how to do it and made the changes needed in settings.php, copied zens page.tpl.php file to my subtheme and renamed it maintenance-page.tpl.php

This took care of the themed look but also presented another problem that the page now does not render correctly. To explain, I can create a html page using the div tag to set image positions and it looks great by itself. I can take that same code and paste it in the site maintenance setting and display it but it loses the div tag holders for image placement.

from digging further I found that you can create a maintenance-page-offline.tpl file (see http://drupal.org/node/195435) which i've done but it requires a template suggestion (http://drupal.org/node/223440) and this is where I'm having difficulty. Can someone guide me in creating this function for the template.php file or can someone explain how to render full html when calling maintenance-page.tpl

some where I'm missing something and I'm not familiar enough with the API's to figure out what or how to do what I want to do which is to use either the admin core or the frontpage module to store the offline content and have it display as it would if the full html input filter could be set.

Thanks

Comments

Both templates required in the same folder

Frank Ralf's picture

If I understand the relevant paragraph correctly, you don't need to bother with creating any special function:

To prevent warnings about the database connection from appearing, you can also place a template file named "maintenance-page-offline.tpl.php" and change the $content variable with your custom message. This template file is a template suggestion based on maintenance-page.tpl.php so they both need to exist.
http://drupal.org/node/195435

All it says is that "maintenance-page-offline.tpl.php" is based on "maintenance-page.tpl.php" and requires its existence in the same folder. That's what is meant by it being a "Template Suggestion".

hth
Frank

Both are in the same folder

ctmattice1's picture

Hi Frank,

That's the first thing I tried.

It still calls maintenance-page.tpl.php Further on down the page (http://drupal.org/node/195435) it there's a link called template suggestions (http://drupal.org/node/223440) from what I gather node does this automatically but other types of content don't as you can see in the comments.

In one of the comments it posts this php snippet

<?php
function my_theme_preprocess_page(&$variables) {
  if (
$variables['node']->type != "") {
   
$variables['template_files'][] = "page-node-" . $variables['node']->type;
  }
}
?>

I think this is what I need to add but I'm not sure which variable to use and if I need to set the type other than null.

Thanks for the help