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: Multiple Custom Headers  (Read 3494 times)

0 Members and 1 Guest are viewing this topic.

kingspice

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 61
Multiple Custom Headers
« on: August 02, 2007, 07:54:42 pm »

Hi,
I was wondering if it possible to add a second header that can be included in the same way as {CUSTOM_HEADER}. I want this code to appear the {GALLERY} so {CUSTOM_FOOTER} would not work.

Thanks
Gareth
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Multiple Custom Headers
« Reply #1 on: August 03, 2007, 08:04:04 am »

Huh? Review your posting, I don't understand. Some words seem to be missing.
Logged

kingspice

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 61
Re: Multiple Custom Headers
« Reply #2 on: August 03, 2007, 11:53:25 am »

Hi,
Sorry I missed a few words out :) Hopefully this will be a bit clearer.

Basically I want to have an additional {CUSTOM_HEADER} e.g. {CUSTOM_HEADER2}, to include a PHP file in my template.html. I was just wondering is this possible?

I am not using the default {CUSTOM_FOOTER} as the content I want to include will appear above {GALLERY}.

Thanks
Gareth
Logged

Nibbler

  • Guest
Re: Multiple Custom Headers
« Reply #3 on: August 03, 2007, 02:35:31 pm »

Just include it at the end of your existing header script.
Logged

kingspice

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 61
Re: Multiple Custom Headers
« Reply #4 on: August 04, 2007, 02:46:07 am »

Hi,
I wanted to seperate the two headers as they are included at different points in template.html
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Multiple Custom Headers
« Reply #5 on: August 04, 2007, 01:28:28 pm »

Edit themes/yourtheme/template.html and add the token {CUSTOM_HEADER2} as you see fit.
Then edit themes/yourtheme/theme.php ,find
Code: [Select]
function pageheaderand edit as suggested below. If you don't have that function definition in your custom theme, copy
Code: [Select]
// Function for writing a pageheader
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

        $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
        header("Content-Type: text/html; charset=$charset");
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $charset,
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
        );

    echo template_eval($template_header, $template_vars);
}
from themes/sample/theme.php into a new line before
Code: [Select]
?> of themes/yourtheme/theme.php

To add the needed code for the second token, find
Code: [Select]
$custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);and add after if (into a new line)
Code: [Select]
$custom_header2 = cpg_get_custom_include('path/to/your/second/header.file');
Then find
Code: [Select]
        '{CUSTOM_HEADER}' => $custom_header,and add after it (into a new line)
Code: [Select]
        '{CUSTOM_HEADER2}' => $custom_header2,
Logged
Pages: [1]   Go Up
 

Page created in 0.029 seconds with 15 queries.