Advanced search  

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]

Pages: [1]   Go Down

Author Topic: getting error adding a php include pageheader  (Read 4806 times)

0 Members and 1 Guest are viewing this topic.

Steffi

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 19
    • Tischtennis Bezirk Ulm
getting error adding a php include pageheader
« 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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
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.
« Last Edit: November 01, 2005, 08:26:40 pm by Nibbler »
Logged

Nibbler

  • Guest
Re: getting error adding a php include pageheader
« Reply #1 on: November 01, 2005, 03:14:44 pm »

Split this line
Code: [Select]
static $custom_header = ob_get_contents();
like this:

Code: [Select]
static $custom_header;
$custom_header = ob_get_contents();
Logged

Steffi

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 19
    • Tischtennis Bezirk Ulm
Re: getting error adding a php include pageheader
« Reply #2 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)
Logged

Nibbler

  • Guest
Re: getting error adding a php include pageheader
« Reply #3 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.
Logged

Steffi

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 19
    • Tischtennis Bezirk Ulm
Re: getting error adding a php include pageheader
« Reply #4 on: November 01, 2005, 03:23:02 pm »

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

Nibbler

  • Guest
Re: getting error adding a php include pageheader
« Reply #5 on: November 01, 2005, 03:25:26 pm »

What's in _top.php ?
Logged

Steffi

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 19
    • Tischtennis Bezirk Ulm
Re: getting error adding a php include pageheader
« Reply #6 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)
Logged

Steffi

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 19
    • Tischtennis Bezirk Ulm
Re: getting error adding a php include pageheader
« Reply #7 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)

Code: [Select]
   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:
Code: [Select]
'{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)
Logged

Steffi

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 19
    • Tischtennis Bezirk Ulm
Re: getting error adding a php include pageheader
« Reply #8 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???

Logged

Steffi

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 19
    • Tischtennis Bezirk Ulm
Re: getting error adding a php include pageheader
« Reply #9 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/
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 19 queries.