coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: Steffi on November 01, 2005, 02:23:30 PM

Title: getting error adding a php include pageheader
Post by: Steffi on November 01, 2005, 02:23:30 PM
Hello,

want to include Coppermine into my existing Website. I already have header and footer and would like to use it.
So I went to FAQ http://coppermine.sourceforge.net/faq.php#customHeader and tried this solution...

I copied the whole code:
function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;

   if(empty($custom_header)){
      include('/path/your_file.php');
      static $custom_header = 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);
}


And changed it:
function pageheader($section, $meta = '')
{
   global $CONFIG, $THEME_DIR;
   global $template_header, $lang_charset, $lang_text_dir;

   if(empty($custom_header)){
      include($_SERVER['DOCUMENT_ROOT'] .'/_top.php');    // My Change, that´s all
      static $custom_header = 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);
}


And put in templates.html the {CUSTOM_HEADER} right after the body tag.

Doesn´t work, gives me the following error:
Parse error: parse error, expecting `','' or `';'' in /.../interaktiv/fototausch/themes/ttbezirkulm/theme.php on line 838

Line 838 ist that one: static $custom_header = ob_get_contents();

Don´t understand the thing, because I´m using the include with "$_SERVER['DOCUMENT_ROOT']" in my whole Website, so why should it not work in here?

Thanks for any help,
Steffi

PS: Didn´t find a solution by searching the forum with "pageheader error $_SERVER", so I think this may be a new topic.
Title: Re: getting error adding a php include pageheader
Post by: Nibbler on November 01, 2005, 03:14:44 PM
Split this line
static $custom_header = ob_get_contents();

like this:

static $custom_header;
$custom_header = ob_get_contents();
Title: Re: getting error adding a php include pageheader
Post by: Steffi on November 01, 2005, 03:19:52 PM
Thanks so far, my page goes a little further now.
I see some stuff of my custom header.

But as soon as Coppermine Code is supposed to start, I get this error:

Fatal error: Cannot redeclare cpggetuserdata() (previously declared in /.../interaktiv/fototausch/include/init.inc.php:45) in /.../interaktiv/fototausch/include/init.inc.php on line 45
(Replaced some text through ... for a better look)
Title: Re: getting error adding a php include pageheader
Post by: Nibbler on November 01, 2005, 03:21:20 PM
That means you've include()ed coppermine's init.inc.php twice. Make sure your custom header does not include this file.
Title: Re: getting error adding a php include pageheader
Post by: Steffi on November 01, 2005, 03:23:02 PM
???
Didn´t change any of the code yet... (except the pageheader thing)
Title: Re: getting error adding a php include pageheader
Post by: Nibbler on November 01, 2005, 03:25:26 PM
What's in _top.php ?
Title: Re: getting error adding a php include pageheader
Post by: Steffi on November 01, 2005, 03:31:02 PM
Some HTML Stuff and some more includes (to menu navigation, to DB etc.)
But in none of them is another cpggetuserdata

(Did a search for "cpggetuserdata" through my whole site, without result in my "own" code)
Title: Re: getting error adding a php include pageheader
Post by: Steffi on November 01, 2005, 04:37:02 PM
OK,

did a little testing now...

put my "_top.php" in the same directory and took EVERYTHING out of it except the word "TEST" (means it´s an empty page now, only the word "TEST" is in it).

So the code looks like that now (Only include line changed)

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


And I get this error:
Fatal error: Call to undefined function: theme_main_menu() in /.../interaktiv/fototausch/themes/ttbezirkulm/theme.php on line 853

line 853 is this one:
'{MAIN_MENU}' => theme_main_menu(),

(Maybe I should say that the theme "ttbezirkulm" which I use is a fresh copy of another theme, without anything changed so far)
Title: Re: getting error adding a php include pageheader
Post by: Steffi on November 01, 2005, 05:53:42 PM
OK, I kind of "fixed" it...

Found out there are different codes in the different theme.php´s

The Theme I´v used did not have MAIN_MENU, but MAIN_MENU1 and MAIN_MENU2.

So I got it up an running...

But I´ve also found out that Coppermine is not running with my templates... (wrong, my navigation is not running, after I included my Top and Bottom into Coppermine)

I have a CSS Design with a lot of Div´s with TOP, BOTTOM and 3 COLUMS (was quite tricky, but works very good).

For those who are interested, what I actually wanted can read here:

What I wanted to do is to integrate the Gallery into the Middle Column - doesn´t work (see example)

--------------------------TOP-------------------------------

Column1           Column2                Column3

---------------------Bottom-------------------------------

The style works like that: I have the Top included within a page, after that comes the actual content and my Column1 (left.php) and Column3 (right.php) are included in the Bottom, which comes right after the actual content, like that:

1. include top.php
2. content
3. include bottom .php

and in bottom.php are right and left included...

Thats all...

The gallery was supposed to be the content/column2, but unfortunately doesn´t work with my css-navigation.

Whoever is interested in it can see my pages here:
http://www.tt-bezirk-ulm.de/

Well - I guess I´ll give it a try with an I-Frame...
Or is there another solution???

Title: Re: getting error adding a php include pageheader
Post by: Steffi on November 01, 2005, 08:23:46 PM
OK, got it!!!
Works very good with working on own template style...

I´m not done yet, but it already looks like the rest of my pages, want to see?
(There´s still no link to my gallery, so my members still can´t use it...)

My Page http://www.tt-bezirk-ulm.de
with Gallery http://www.tt-bezirk-ulm.de/interaktiv/fototausch/