[development] preprocess page doesn't take all variables

Ernst Plüss ernst.pluess at gmail.com
Thu May 28 07:30:47 UTC 2009


Hi

I'm trying to do a simple thing in D6: Add a variable to the page template.
Unfortunately it seams, that it gets lost in theme_render_template.

This is my code in the template.php:

function ylt_preprocess_page(&$vars) {
    $vars['rabarber'] = 'rabarber';
}

theme_render_template looks like this:

function theme_render_template($template_file, $variables) {
 extract($variables, EXTR_SKIP);  // Extract the variables to a local
namespace
 ob_start();                      // Start output buffering
 include "./$template_file";      // Include the template file
 $contents = ob_get_contents();   // Get the contents of the buffer
 ob_end_clean();                  // End buffering and discard
 return $contents;                // Return the contents
}

I can see rabarber in $variables, but it never ends up beeing extracted.
Actually $variables contains about 47 entries but only about 12 of them get
extracted.

Is this a bug or am I doing something wrong?

Best Regards
Ernst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/development/attachments/20090528/e7c9cfed/attachment-0001.htm>


More information about the development mailing list