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: How to include php column header & footer in template sy  (Read 37694 times)

0 Members and 1 Guest are viewing this topic.

TheFinnisher

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
    • http://www.thefinnisher.com
How to include php column header & footer in template sy
« on: October 15, 2003, 12:56:29 pm »

Hello,
I have a question regarding customizing Coppermine into my website. I am trying to add my website's own header by doing a php include.

I read the FAQ's and it had some advice on how to do this. Unfortunately I am getting some errors...

Can anyone advice me on what I may be doing wrong?

This is what I did change (as in the FAQ):

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

   if(empty($custom_header)){
      include('../../../../includes/header.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);
}


But I am getting the following error:

Code: [Select]
Parse error: parse error, expecting `','' or `';'' in /home/geoff/gallery/themes/hardwired/theme.php on line 741

Fatal error: Call to undefined function: pageheader() in /home/geoff/gallery/index.php on line 432


Line 741 points at this statement:

Code: [Select]
static $custom_header = ob_get_contents();
but I don't know what to change?

When I removed the following code I was able to get the gallery show up but for some reason it couldn't find my header. What does this code refer to:

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


Ideally I would like to be able to change the template so that I would have my own php included header/footer and left column/right column. I am trying to build a CMS for a volunteer project.

I would very much appreciate if someone could take the time to explain how I can acchieve this in the template design.

I also tried to change the template configuration value of html extension to php in the includes/init.inc.php file and then change the template.html file to template.php with the normal php include commands. Unfortunately it didn't work :cry:

I am not really a programmer of heart. I mostly do the trial and error thing...and now I have come to a complete stop.

Any help would be appreciated!  :)  :D
Logged

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
How to include php column header & footer in template sy
« Reply #1 on: October 15, 2003, 04:37:54 pm »

TheFinnisher,

Please post your theme.php file and index.php file in full.

-Hyperion
Logged
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

TheFinnisher

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
    • http://www.thefinnisher.com
How to include php column header & footer in template sy
« Reply #2 on: October 16, 2003, 12:36:08 pm »

Hi Hyperion,
Thanks for you reply! Of course I will post them. The website I am developing is: http://www.flagstaffbiking.org and my development site is located at: http://www.flagstaffbiking.org/default.php The photo gallery is located at: http://www.flagstaffbiking.org/gallery/index.php

I am trying to re-new this biking related site to become more dynamic. It's too time consuming to update it manually. And I'm trying to make it so that many people can submit articles. I am using osCommerce as the base, so that we in the future can process donations and membership. With some help I was able to integrate the loginprocess to phpBB and I am hoping to do the same with the Coppermine Gallery. Basically I am trying to compose a web page that will be a great tool for all users.

At this point I am not too concerned about the design itself. I just want to get the functionality up.

One of the steps is off course to be able to add the custom header and footer to the gallery. I haven't decided completely on the navigation system...but for now I would love to be able to put in a custom left and custom right column.

I've been trying to understand the template system of the Coppermine but still don't completely understand the functions.

It would be great if you would be able to guide me as how to get those includes to show up in my Coppermine template. :D

As the files you requested are pretty large in size...would it be possible for me to e-mail them to you? I don't know if it is ok to post that much code on this forum? I will PM you my e-mail address and perhaps you could e-mail me back with yours? or anyone else for that matter...

If a moderator is reading this post...am I doing the right thing?

The theme.php file has close to 1500 lines and the index.php file close to 600. Please let me know what would be the best way. I am eager to get this GREAT :!:  Photo album integrated.

Thanks very much!

Thomas
Logged

moorey

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 404
How to include php column header & footer in template sy
« Reply #3 on: October 17, 2003, 05:44:15 am »

Try this - it works for me; change as necessary and remember to add a {CUSTOM_HEADER} in your template.html:

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

if(empty($custom_header)){

require("http://www.path.to/include.file");
$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);  
}
Logged

TheFinnisher

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
    • http://www.thefinnisher.com
How to include php column header & footer in template sy
« Reply #4 on: October 21, 2003, 05:31:45 am »

Hyperion,
Thanks for your PM note! Yeah, I do realize the value of posting problems and solutions in the open. I know now that is is ok to post code in its entire, and I will do so.

Moorey,
Thanks for your suggestion! Your code did work for most part of it except for that I wasn't able to use the absolute link to my "header file". I have a htaccess file in that folder, and it won't allow me to accesss the file in a http request.

I tried with the relative link but couldn't get it to work...So then I tried with the following (I don't even know the definition of this method):



Code: [Select]
/home/user/includes/header.php

and that seemed to work...However I ran into some problems of functions the header is referring to. I should be able to somehow bring in those functions into the Gallery files or alternatively require the function files before I do the header. TOO BAD I AM SWAMPED FOR TIME WITH SCHOOL RIGHT NOW :(

Anyhow, I will give it a try later on...

If you have any ideas or the time in the mean...How would I include a left column/right column?

I assume I should be able to include the footer in the footer function?

Anyhow, I gotta get back to school work...(and I would much rather prefer to work on this).

Thanks again! I will keep you posted...

Have a good day!

Thomas
Logged

farmer

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
How to include php column header & footer in template sy
« Reply #5 on: October 27, 2003, 04:18:11 am »

ok, that works perfectly for the header part. But how to include my custom footer? The code looks a bit different there:
Code: [Select]

// 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']) {
        $time_end = getmicrotime();
        $time = round($time_end - $time_start, 3);

        $query_count = count($query_stats);
        $query_times = '';
        $total_query_time = 0;
        foreach ($query_stats as $qtime) {
            $query_times .= round($qtime, 3) . "s ";
            $total_query_time += $qtime;
        }
        $total_query_time = round($total_query_time, 3);

        starttable('100%', 'Debug info');
        echo "<tr><td class=\"tableb\">";
        echo "USER: <pre>";
        print_r($USER);
        echo "</pre></td></tr><td class=\"tableb\">";
        echo "<tr><td class=\"tableb\">";
        echo "USER DATA: <pre>";
        print_r($USER_DATA);
        echo "</pre></td></tr><td class=\"tableb\">";
        echo "<tr><td class=\"tableb\">";
        echo "Queries: <pre>";
        print_r($queries);
        echo "</pre></td></tr><td class=\"tableb\">";
        echo "GET :<pre>";
        print_r($HTTP_GET_VARS);
        echo "</pre></td></tr><td class=\"tableb\">";
        echo "POST :<pre>";
        print_r($HTTP_POST_VARS);
        echo "</pre></td></tr><td class=\"tableb\" >";
        echo <<<EOT
                Page generated in <b>$time</b> seconds - <b>$query_count</b> queries in <b>$total_query_time</b> seconds -

Album set : $ALBUM_SET
EOT;
        echo "</td></tr>";
        echo "<tr><td class=\"tableb\">";
        echo "<a href=\"phpinfo.php\">Advanced debug mode</a> (phpinfo)";
        echo "</td></tr>";
        endtable();
    }

    echo $template_footer;

}


Any ideas?
Logged

al-Sahhaf

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: How to include php column header & footer in template sy
« Reply #6 on: May 17, 2004, 10:15:30 am »


and that seemed to work...However I ran into some problems of functions the header is referring to. I should be able to somehow bring in those functions into the Gallery files or alternatively require the function files before I do the header.

I've got the same problem, does someone has a solution yet?
Logged
Pages: [1]   Go Up
 

Page created in 0.032 seconds with 18 queries.