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 Header problem - Showing {CUSTOM_HEADER} instead of my included php code?  (Read 3091 times)

0 Members and 1 Guest are viewing this topic.

seanophobia

  • Coppermine newbie
  • Offline Offline
  • Posts: 18

I followed the documentation on how to do custom header etc, was getting a error, but i searched and fixed by changing
Code: [Select]
function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;
   
   if(empty($custom_header)){
      include('/includes/counter.php');
      static $custom_header = ob_get_contents();
      ob_clean();
   }

to

Code: [Select]
function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;
   static $custom_header;
   
   if(empty($custom_header)){
      include('counter.php');
      ob_clean();
   }

Which got rid of my error, but now when i put {CUSTOM_HEADER} in my template.html its not including the counter.php , its just showing {CUSTOM_HEADER}

I searched but i didnt find solution, if this problem has already been solved can someone point me to the page?
« Last Edit: June 12, 2005, 06:26:36 am by donnoman »
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray

The code you changed to won't EVER do anything.

Your code basically says start an output buffer (meaning capture output to memory instead of screen), inlcude the file (which creates output and is stored in memory), then clean out the buffer (throw away what was just put in the buffer).

Based on the fact that you say the error went away this is probably the correct way to populate the $custom_header variable.

Code: [Select]
function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;
   
   if(empty($custom_header)){
      include('counter.php');
      static $custom_header = ob_get_contents();
      ob_clean();
   }

Now you need to make the actual substitution happen, note the {CUSTOM_HEADER} token in the list of replacments.

in the pageheader function:
Code: [Select]
  $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,
   );

Logged

seanophobia

  • Coppermine newbie
  • Offline Offline
  • Posts: 18

solved, thankz a bunch  ;D
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.