getting error adding a php include pageheader getting error adding a php include pageheader
 

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]

Main Menu

getting error adding a php include pageheader

Started by Steffi, November 01, 2005, 02:23:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Steffi

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.

Nibbler

Split this line
static $custom_header = ob_get_contents();

like this:

static $custom_header;
$custom_header = ob_get_contents();

Steffi

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)

Nibbler

That means you've include()ed coppermine's init.inc.php twice. Make sure your custom header does not include this file.

Steffi

???
Didn´t change any of the code yet... (except the pageheader thing)


Steffi

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)

Steffi

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)

Steffi

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???


Steffi

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/