Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Custom PHP Header returning Parse Error  (Read 3838 times)

0 Members and 1 Guest are viewing this topic.

BrianD

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
Custom PHP Header returning Parse Error
« on: November 04, 2005, 09:02:33 pm »

I attempted to create a custom PHP header as described in the FAQ.  Here is my code from theme.php

Code: [Select]
function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;

   if(empty($custom_header)){
      include('/menu/menu.php');
      static $custom_header = ob_get_contents();
      ob_clean();
   }

   header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
   user_save_profile();

   $template_vars = array(
      '{LANG_DIR}' => $lang_text_dir,
      '{TITLE}' => $CONFIG['gallery_name'].' - '.$section,
      '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
      '{META}' => $meta,
      '{GAL_NAME}' => $CONFIG['gallery_name'],
      '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
      '{MAIN_MENU}' => theme_main_menu(),
      '{ADMIN_MENU}' => theme_admin_mode_menu(),
      '{CUSTOM_HEADER}' => $custom_header,
   );

   echo template_eval($template_header, $template_vars);
}

My custom header is off the root in the menu directory and named menu.php.  If I run menu.php separately it runs fine.

Here is the error I am recieveing:

Parse error: parse error, expecting `','' or `';'' in e:\html\domains\kendrabrian.com\wwwroot\pictures\themes\KendraBrian\theme.php on line 821

Line 821 is:
static $custom_header = ob_get_contents();

I cannot see where I am went wrong or what the error is telling me.

Thanks
Brian D
Logged

Nibbler

  • Guest
Re: Custom PHP Header returning Parse Error
« Reply #1 on: November 04, 2005, 09:03:54 pm »

Change

Code: [Select]
static $custom_header = ob_get_contents();
to

Code: [Select]
static $custom_header;
$custom_header = ob_get_contents();
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 20 queries.