coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: kingspice on August 02, 2007, 07:54:42 PM

Title: Multiple Custom Headers
Post by: kingspice 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
Title: Re: Multiple Custom Headers
Post by: Joachim Müller on August 03, 2007, 08:04:04 AM
Huh? Review your posting, I don't understand. Some words seem to be missing.
Title: Re: Multiple Custom Headers
Post by: kingspice 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
Title: Re: Multiple Custom Headers
Post by: Nibbler on August 03, 2007, 02:35:31 PM
Just include it at the end of your existing header script.
Title: Re: Multiple Custom Headers
Post by: kingspice 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
Title: Re: Multiple Custom Headers
Post by: Joachim Müller 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 ,findfunction pageheaderand edit as suggested below. If you don't have that function definition in your custom theme, copy// 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?> of themes/yourtheme/theme.php

To add the needed code for the second token, find$custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);and add after if (into a new line)$custom_header2 = cpg_get_custom_include('path/to/your/second/header.file');

Then find        '{CUSTOM_HEADER}' => $custom_header,and add after it (into a new line)        '{CUSTOM_HEADER2}' => $custom_header2,