forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: mika2k3 on May 23, 2004, 06:00:36 pm

Title: Bug with a custom footer ? (i've read the faq)
Post by: mika2k3 on May 23, 2004, 06:00:36 pm
Hello Everybody !

I want to have a custom header and a custom footer. I've read the FAQ (of course  ;) ) but have still a problem :

I've modified the "theme.php" file :

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

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

if(empty($custom_footer)){
      include('footer.htm');
      $custom_footer = 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,
        '{MAIN_MENU}' => theme_main_menu(),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
'{CUSTOM_HEADER}' => $custom_header,
'{CUSTOM_FOOTER}' => $custom_footer
        );

    echo template_eval($template_header, $template_vars);
}


And my "template.html" file :

Code: [Select]
{CUSTOM_HEADER}
<link rel="stylesheet" href="themes/odileetmatthieu/style.css" />
<script type="text/javascript" src="scripts.js"></script>
<table width="100%" height="100%" border="0" cellpadding="2" cellspacing="2" bgcolor="#E3BE0A">
<tr>
<td align="center" valign="top">
{MAIN_MENU}
{ADMIN_MENU}
{GALLERY}
</td>
</tr>
</table>
{CUSTOM_FOOTER}

The problem is that my {CUSTOM_FOOTER} isn't interpreted (i see nothing under the gallery !?)

But if i change my "template.html" like this...

Code: [Select]
{CUSTOM_HEADER}
{CUSTOM_FOOTER}
<link rel="stylesheet" href="themes/odileetmatthieu/style.css" />
<script type="text/javascript" src="scripts.js"></script>
<table width="100%" height="100%" border="0" cellpadding="2" cellspacing="2" bgcolor="#E3BE0A">
<tr>
<td align="center" valign="top">
{MAIN_MENU}
{ADMIN_MENU}
{GALLERY}
</td>
</tr>
</table>

I see my header. It seems that everything under {GALLERY} is ignored ??


Can u help me please.

Thanks.
Title: Re: Bug with a custom footer ? (i've read the faq)
Post by: glaive on July 17, 2004, 03:09:47 pm
Just a thought, I've only been at it a couple hours, but I've been programming for a very long time.
If you look below the the header function  in "theme.php" you will find the footer function.

Repeat what you have done with the header file in the header function, only with the footer file in the footer function.

Cheers
Alex
Title: Re: Bug with a custom footer ? (i've read the faq)
Post by: Joachim Müller on July 17, 2004, 03:23:19 pm
You may find thisthread from the old support board helpfull:
Quote from: greg link=http://coppermine.sourceforge.net/oldboard/viewtopic.php?t=1825
When the template.html is read, it is splitted in 2. What is before the {GALLERY} tag is output by the pageheader function, what is after by the pagefooter function.

If your menu is in the "footer" you need to modify your theme.php file
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()
        );

        echo template_eval($template_header, $template_vars);
will become
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'],
        );

        echo template_eval($template_header, $template_vars);
and
Code: [Select]
echo $template_footer;will become
Code: [Select]
       $template_vars = array(
                '{MAIN_MENU}' => theme_main_menu(),
                '{ADMIN_MENU}' => theme_admin_mode_menu()
        );

        echo template_eval($template_footer, $template_vars);

Greg

GauGau