Space between my custom footer and CPG copyright Space between my custom footer and CPG copyright
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Space between my custom footer and CPG copyright

Started by Bulgaricus, September 11, 2004, 08:12:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bulgaricus

Hello,

I have just installed Coppermine on my site and I am customizing it.

Do you know how I can change the space (decrease it) between my cistom footer and the CPG copyright footer? You can have a look how is it now on www.bulgaricus.com/galeria

Joachim Müller

You have added not only plain html commands, but you alos add an additional <head></head></body> and  </body>, making your output completely non-standards compliant. You have two stylesheets (one you insert, one from coppermine) that has commands that contradict each other (as coppermine's stylesheet is called later, the properties from it will overrule yours). Please post your modifications (how you do insert your content, and what exactly) - just by looking at the html output I can only tell you what doesn't work, but I can't tell you how to make it work.

Joachim

Bulgaricus

I have added to theme.php the followinh code:

<?php include '../menu_main.htm'; ?>

<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.3.2                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002-2004 Gregory DEMAR                                     //


and

// Function for writing a pagefooter
function pagefooter()
{
global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
global $USER, $ALBUM_SET, $CONFIG, $time_start, $query_stats;
global $template_footer;

if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
cpg_debug_output();
}

// Create Custom Footer

if(empty($custom_footer)){
   
include('../stopka_for.php');
}


echo $template_footer;
}

Joachim Müller

well, that's not the way this is correcty done, as your custom header will come before coppermine's own header, that contains the redirect stuff in the meta tag.
Generally speaking, remove the <head>, <html> and <body> sections from your custom footer, for more details, zip them up and attach them to your posting, along with any other relevant files. Please don't let us ask for every piece of information, why don't you just give it to us - will make support easier.

Joachim

Bulgaricus

Sorry for not giving full information. No I will correct my mistake :)

I have attached to that post my header and footer files. My site is biuld that way that each page has at the beginning <include header..> and at the end <include footer..>. Meta tags and the HTML sceleton are in that two files, so it is very easy to update them. If I remove the <head>, <html> and <body>, I will have to create a special version of these files for the gallery which is not very convenient :(

Joachim Müller

#5
OK, I have created a small mod for you that will add your custom header and footer half-correctly. Please note that this will not create anything that even closely resembles valid code, but I guess you don't mind, as your includes themselves are very far from compliance with anything ;):
It's also not recommended to mess with the classic theme that comes with coppermine as you did, but create your own theme that is based on the classic theme. Anyway, you did what you did, and it's your page to break (will make future updates harder).

Step 1:
edit themes/yourtheme/theme.php and undo your modification, as they're just plainly wrong. Remove <?php include '../menu_main.htm'?>and// Create Custom Footer

if(empty($custom_footer)){
   
include('../stopka_for.php');
}


Step 2:
Edit themes/yourtheme/template.html, find<body>and add after it (in a new line of it's own):{CUSTOM_HEADER}
Then find</body>and add right before it (in a new line of it's own){CUSTOM_FOOTER}
Those two entries are the placeholders where you want your custom header and footer finally to appear on your page. You can come up with any other position in your template.html file (within the <body></body> section!) if you want.

Step 3:
Edit themes/yourtheme/theme.php once more, findfunction pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    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(),
        );

    echo template_eval($template_header, $template_vars);
}
// Function for writing a pagefooter
function pagefooter()
{
    global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
    global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;;
    global $template_footer;

    if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
    cpg_debug_output();
    }

    echo $template_footer;
}
and replace withfunction pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

   // this is the place where the custom header file gets included
   if(empty($custom_header)){
      ob_start();
      include('menu_main.htm');
      $custom_header = cleanup_custom_includes(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);
}
// Function for writing a pagefooter
function pagefooter()
{
    global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
    global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;;
    global $template_footer;

   // this is the place where the custom footer file gets included
   if(empty($custom_footer)){
      ob_start();
      include('stopka_for.php');
      $custom_footer = cleanup_custom_includes(ob_get_contents());
      ob_clean();
   }

    if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
    cpg_debug_output();
    }

    $template_vars = array(
        '{CUSTOM_FOOTER}' => $custom_footer,
    );

    echo template_eval($template_footer, $template_vars);
}

// Function to clean up any double html leftovers from the custom header and footer that are not meant to get parsed
function cleanup_custom_includes($string) {
    $string = str_replace('<HTML>', '', $string);
    $string = str_replace('<HEAD>', '', $string);
    $string = str_replace('<BODY>', '', $string);
    $string = str_replace('</HTML>', '', $string);
    $string = str_replace('</HEAD>', '', $string);
    $string = str_replace('</BODY>', '', $string);
    return $string;
}


You might have to edit the paths to your include files, look for the lines      include('menu_main.htm');and      include('stopka_for.php');, they have to be the paths to those incluide files, relative from your coppermine root folder (or make them absolute paths, doesn't matter).
Notice the crude replacement function I added (cleanup_custom_includes): it will replace the worst cases of code mismatch by stripping your overhead tags, but they will still leave your page as code soup, with improper reference (e.g. the meta tags residing inside the body of the page). There's a lot of redundant JavaScript on your page as well that would better be done with some simple php code, but then again: you probably will not care. I just want to warn you: creating such proprietary, non-standards code will probably render your site "strangely" in many browsers (not the browser's fault, but your code's fault), and it will make future adjustments necessary to your code.

Step 4:
Upload the whole enchilada to your site, test it and report back here.

Cheers

Joachim

Bulgaricus

Thanks, Joachim for the support. There is such mess im in code because I have a very plain idea of PHP, absolutely no idea of JavaScript and some medium knowledge of HTML. You see, after working hours I administrate Bulgaricus.com as a hobby. I am aware that my site is far from being perfect and I am very grateful when someone poits my mistakes and helps me to correct them.

Coming back to the point of that topic, I have made the changes that you suggested. Some strange code appeared on my page. Can you have a look at it on www.bulgaricus.com/galeria and eventually advise me something?

Thanks in advance!

Joachim Müller

There's a closing tag missing somewhere. Zip up the full content of your theme folder (in your case the whole folder "classic" and everything within it, preserving the folder structure). Attach the zip to your posting.

Joachim

Bulgaricus

O.K. my classic theme is attached

Joachim Müller

the issues you're facing are being caused by not reading the instructions I posted, or not doing as suggested. I will not support you any further if you don't do what I tell you to and even don't bother to review your modifications by comparing them to my instructions. You haven't replaced everything I told you to, but only bits of it, that's what is causing the garbled output.
Download attached file, save it into your classic theme folder, rename it from theme.txt to theme.php (rename your existing file to something else, or delete it completely). Upload and smile.

Joachim

Bulgaricus

Thanks a lot Joachim! You are great! Now it works :)

Do you know now, how can I move CPG Copyright under my footer and decrease the space between them?

Joachim Müller

I won't tell you how to move the copyright tag around (see http://coppermine.sourceforge.net/faq.php#editCopyrights ). Edit the margin and padding attributes in your stylesheets (you have to modify two of them as you chose to include your header instead of modifying the coppermine theme files as suggested). The classes to look for are "maintable", table, tr, td in themes/classic/style.css and of course http://bulgaricus.com/galeria/themes/classic/style.css
Also remove all height attributes in <table>, <tr> and <td> tags everywhere (as they're a silly thing in the first place), especially in themes/classic/template.html
The next thing to play around with is the spacer image: edit themes/classic/theme.php, find<img src="images/spacer.gif" width="1" height="17" /><br />You'll notice it's in the code several times, change one or more of them to have a smaller hieght attribute, e.g.<img src="images/spacer.gif" width="1" height="5" /><br />

Joachim


kroberson

ok... I used the exact file you sent to the other guy but changed the file name... however, its causing database issues for some reason... any suggestions... thank you, in advance.

http://www.myspecialdog.com/spotlight/

Kevin

Joachim Müller

don't use the pre-made files - instead, try to understand my postings and modify your files accordingly.

blambert

Thanks GauGau,
you solved my problem.
now I need a IF ELSE SWITCH....can you help with that?
http://www.lambertandassoc.com/photos/index.php

Hamsterpants

GauGau rocks  .... this post sorted my probs out as well thankyou very much. I reacon a link to this post should be included in manual under the Custom Header and Footer section.

Dill
www.mystaffie.com
Dillon Weyer
dill@mystaffie.com

CoasterJoe.com

Hi. Is there a way to modify this code to include more then two files? I would like to be able to include two more. I played around with it a little bit but I could not quite figure it out. Any help or suggestions would be appreciated. Thank you.function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

   // this is the place where the custom header file gets included
   if(empty($custom_header)){
      ob_start();
      include('menu_main.htm');
      $custom_header = cleanup_custom_includes(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);
}
// Function for writing a pagefooter
function pagefooter()
{
    global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
    global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;;
    global $template_footer;

   // this is the place where the custom footer file gets included
   if(empty($custom_footer)){
      ob_start();
      include('stopka_for.php');
      $custom_footer = cleanup_custom_includes(ob_get_contents());
      ob_clean();
   }

    if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
    cpg_debug_output();
    }

    $template_vars = array(
        '{CUSTOM_FOOTER}' => $custom_footer,
    );

    echo template_eval($template_footer, $template_vars);
}

// Function to clean up any double html leftovers from the custom header and footer that are not meant to get parsed
function cleanup_custom_includes($string) {
    $string = str_replace('<HTML>', '', $string);
    $string = str_replace('<HEAD>', '', $string);
    $string = str_replace('<BODY>', '', $string);
    $string = str_replace('</HTML>', '', $string);
    $string = str_replace('</HEAD>', '', $string);
    $string = str_replace('</BODY>', '', $string);
    return $string;
}

Joachim Müller

you can include as many files as you want. If you want to include them in different places, you have to add more placeholder tokens.

CoasterJoe.com

I figured out what I was doing wrong, I was using the code for the header to put stuff in the footer and obvisouly it was notgoing to work :D  I changed it around and it worked perfectly! Thanks for the help!