Creating a custom page with a difference

Discussion forum for MOD Writers regarding MOD Development.
Locked
craiga
Registered User
Posts: 191
Joined: Fri Apr 10, 2009 8:14 am
Contact:

Creating a custom page with a difference

Post by craiga » Tue Mar 30, 2010 4:29 pm

I want to create a custom page within phpbb which contains the forums header and footer. I also want to include php code that already uses a class of user. I am not comfortable editing the non phpbb php code, so i would like to leave it as is.

When i follow the guide at http://www.phpbb.com/kb/article/add-a-n ... -to-phpbb/ i receive the following error

Code: Select all

Fatal error: Cannot redeclare class User in [the new php page]
my php file looks like

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

page_header('Links');

CUSTOM PHP CODE HERE

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();

?>
my question is, is there any way to include my forums header and footer, while still using my new php code, that just so happens to use a php class of User?

If i havent described what i want well enough, i can provide more information

Mr. Bond
Registered User
Posts: 54
Joined: Mon Feb 04, 2008 1:11 pm

Re: Creating a custom page with a difference

Post by Mr. Bond » Tue Mar 30, 2010 5:03 pm

Just like the PHP error message tells you, you cannot redeclare the user class, it already exists. Change the name of your class to something else.

craiga
Registered User
Posts: 191
Joined: Fri Apr 10, 2009 8:14 am
Contact:

Re: Creating a custom page with a difference

Post by craiga » Tue Mar 30, 2010 5:32 pm

Mr. Bond wrote:Just like the PHP error message tells you, you cannot redeclare the user class, it already exists. Change the name of your class to something else.
the code i am adding isnt mine and i dont want to mess with it if at all possible.

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21034
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: Creating a custom page with a difference

Post by RMcGirr83 » Tue Mar 30, 2010 6:43 pm

Then do a check first to see if the class exists. Not seeing your "custom code" can't help much more than that.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

craiga
Registered User
Posts: 191
Joined: Fri Apr 10, 2009 8:14 am
Contact:

Re: Creating a custom page with a difference

Post by craiga » Wed Mar 31, 2010 7:18 am

RMcGirr83 wrote:Then do a check first to see if the class exists. Not seeing your "custom code" can't help much more than that.
im sorry for being vague about the custom code i am including.

I bought a php/mysql solution from - www.predictionfootball.com . It implements its own user management system, and that is why it defines a class of user.

I plan on putting the pages within my forum, and i dont really mind that the users are seperate. its not ideal, but i can live with it.

Locked

Return to “[3.0.x] MOD Writers Discussion”