[development] preprocess page doesn't take all variables

Moshe Weitzman weitzman at tejasa.com
Thu May 28 19:28:11 UTC 2009


That sounds like a bug in extract(). Perhaps upgrade to latest release of php?

On Thu, May 28, 2009 at 3:30 AM, Ernst Plüss <ernst.pluess at gmail.com> wrote:
> 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
>
>
>


More information about the development mailing list