coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: pszone on November 27, 2006, 09:55:42 PM

Title: How to import phpbb custom header into coppermine theme
Post by: pszone on November 27, 2006, 09:55:42 PM
Hi, I have phpbb and coppermine integrated. For my other pages I make this code (the code at bottom) to load my custom header that I make. That header have login box for my forums and when the user is logged in, it have links to profile and logout. I want my gallery to have the same header, but the template.html can't load php. I try to make header.php file with my header code and load it from admin menu, but then it show's me errors. Here is my header.php code:

<?php
define
('IN_PHPBB'true);
$phpbb_root_path '../forums/';
include(
$phpbb_root_path 'extension.inc');
include(
$phpbb_root_path 'common.'.$phpEx);
//
// Start session management
//
$userdata session_pagestart($user_ipPAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//



if( $userdata['session_logged_in'] ) 
   { 
      
// they're logged in, welcome them, check to see if they're admin, grab their info
{
$u_login_logout 'forums/login.'.$phpEx.'?logout=true&amp;sid=' $userdata['session_id'];
$l_login_logout $lang['Logout'] . ' [ ' $userdata['username'] . ' ]';

}


if ( (
$userdata['session_logged_in']) && (empty($gen_simple_header)) )
{
if ( $userdata['user_new_privmsg'] )
{
$l_message_new = ( $userdata['user_new_privmsg'] == ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text sprintf($l_message_new$userdata['user_new_privmsg']);

if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
{
$sql "UPDATE " USERS_TABLE "
SET user_last_privmsg = " 
$userdata['user_lastvisit'] . "
WHERE user_id = " 
$userdata['user_id'];
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR'Could not update private message new/read time for user'''__LINE____FILE__$sql);
}

$s_privmsg_new 1;
$icon_pm $images['pm_new_msg'];
}
else
{
$s_privmsg_new 0;
$icon_pm $images['pm_new_msg'];
}
}
else
{
$l_privmsgs_text $lang['No_new_pm'];

$s_privmsg_new 0;
$icon_pm $images['pm_no_new_msg'];
}

if ( $userdata['user_unread_privmsg'] )
{
$l_message_unread = ( $userdata['user_unread_privmsg'] == ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
$l_privmsgs_text_unread sprintf($l_message_unread$userdata['user_unread_privmsg']);
}
else
{
$l_privmsgs_text_unread $lang['No_unread_pm'];
}
}
else
{
$icon_pm $images['pm_no_new_msg'];
$l_privmsgs_text $lang['Login_check_pm'];
$l_privmsgs_text_unread '';
$s_privmsg_new 0;
}

$template->assign_vars(array(
'L_LOGIN_LOGOUT' => $l_login_logout,
'L_PRIVATEMSGS' => $lang['Private_Messages'],
'L_PROFILE' => $lang['Profile'],
'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'U_PRIVATEMSGS' => append_sid('privmsg.'.$phpEx.'?folder=inbox'),
'U_LOGIN_LOGOUT' => append_sid($u_login_logout),
'U_PROFILE' => append_sid('profile.'.$phpEx.'?mode=editprofile'),
)
);

$template->set_filenames(array(
"body" => "gn_logged_in.tpl")
);

$template->pparse("body"); 
   } 
else 
       { 
   
   if (!isset($board_config['allow_autologin']) || $board_config['allow_autologin'] )
{
$template->assign_block_vars('switch_allow_autologin', array());
$template->assign_block_vars('switch_user_logged_out.switch_allow_autologin', array());
}
   
   $template->assign_vars(array(
'S_LOGIN_ACTION' => append_sid('forums/login.'.$phpEx),
)
);

               
// they're logged in, welcome them, check to see if they're admin, grab their info
$template->set_filenames(array(
"body" => "gn_login.tpl")
);

$template->pparse("body"); 
   } 
 

//That's It! 
?>


I hope, there is a way to make the header work. Thaks in advance!
Title: Re: How to import phpbb custom header into coppermine theme
Post by: dereksurfs on November 27, 2006, 11:47:56 PM
Well,

That is a lot of code you are dropping in.  Here is what I suggest after just using custom headers myself. 

1. Create a *basic* custom header (ie - Hello World!).
2. Then see try and add it somewhere in your template.
3.  If you get past that step start adding in some your functionality.
4. ** Read the error messages you are getting and work on resolving those.

- Derek
Title: Re: How to import phpbb custom header into coppermine theme
Post by: pszone on November 28, 2006, 07:49:18 AM
When I try to include the header.php it show's me this error:

Fatal error: Cannot redeclare get_username() (previously declared in /home/hosting/gonzo/web/gallery375/include/functions.inc.php:1352) in /home/hosting/gonzo/web/forums/includes/functions.php on line 324

I think it's messing up with the two databases - the coppermine and phpbb. I hope someone know how to fix that.
Title: Re: How to import phpbb custom header into coppermine theme
Post by: dereksurfs on November 28, 2006, 06:48:43 PM
Based on this error I would say that this going to take some work on your part to resolve.  As far as how much I don't know.  But I don't think there will be an easy fix for it.

Error: Cannot redeclare get_username()  does not indicate a database error.  Rather it is saying you are redecaring in your custom header a function that already exsits in coppermine.  You can't do that here. 

The greater question I think is one of website design.  Does phpbb sit inside Coppermine or are you placing Coppermine inside phpbb?  It sounds like you are trying to do both in this case (put part of phpbb inside of CPM when CPM is really inside phpbb).  Either way you cannot have duplicate definitions of these functions.

If you want to try and fix the error you could change the name of the function and all of its references in the header and see what happens.  But there is no guarantee that your approach will work.

- Derek
Title: Re: How to import phpbb custom header into coppermine theme
Post by: dereksurfs on November 28, 2006, 08:43:53 PM
One more thing I noticed after looking at your code briefly.

The get_username() function is delcared somewhere outside this block of code.  So what might be happening is that you are including it twice.

Try removing some of your includes and see what happens:
// include($phpbb_root_path . 'extension.inc');
// include($phpbb_root_path . 'common.'.$phpEx);

- Derek
Title: Re: How to import phpbb custom header into coppermine theme
Post by: khazad on June 22, 2007, 06:25:31 PM
Hi all,

I'm stuck with the same problem...

Could you please tell me how you managed with that issue ?

Thanks a lot
(and excuse me for my poor english)

Khazad.