[Tutorial] Integrate your website around phpBB3

How-to's, little tricks, tutorials, code examples (snippets) and read-me's.

Re: [Tutorial] Integrate your website around phpBB3

Postby Zappien » 12 Oct 2009, 17:06

My IP stay the same. the fact is that when i visit my site with, example; Firefox it will display my name, then i open Internet Explorer and login again, my name appear twice, or even more. I saw that there were even 5 sessions with the same user id, so 5 times the name
Zappien    
Crewman
Crewman
 
Posts: 7
Joined: 10 Oct 2009, 04:42
Gender: Male
phpBB Knowledge: 6


Re: [Tutorial] Integrate your website around phpBB3

Postby topdown » 12 Oct 2009, 17:32

What does the code in your PHP file look like?

This is phpBB's sessions
Code: Select all
$user->session_begin();


So if you have that
phpBB's path defined
Code: Select all
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
include($phpbb_root_path . 'common.' . $phpEx);


and phpBB's common.php the sessions should work fine.
Do not PM me for Support unless I give permission in a post......PM's only help one, posts help everyone !
User avatar
topdown    
STG Styles Leader
STG Styles Leader
 
Posts: 3021
Joined: 01 Oct 2007, 22:56
Location: Handyman's harddrive
Favorite Team: STG Teams
Gender: Male
phpBB Knowledge: 9

Re: [Tutorial] Integrate your website around phpBB3

Postby Zappien » 12 Oct 2009, 17:37

Code: Select all
define('IN_PHPBB', true);
$phpbb_root_path = './forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

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


That is what i have on top of my page. Now the code i using is from a seperate table, "personnel". Now it check the personnel table ( user_id ) with the user_id from phpbb_sessions. So now it shows the users in personnel on my side bar and the registered ( non personnel ) as visitors.
Zappien    
Crewman
Crewman
 
Posts: 7
Joined: 10 Oct 2009, 04:42
Gender: Male
phpBB Knowledge: 6

Re: [Tutorial] Integrate your website around phpBB3

Postby Obsidian » 12 Oct 2009, 17:59

You must have modified the sessions system at some point, or the viewonline code. Try to see if there was a MOD you installed that altered it.
うるさいうるさいうるさい!

StopForumSpam Spam Reporting Database
Giving xrumer and friends a great big "screw you" since 2007.
User avatar
Obsidian    
Supporter
Supporter
 
Posts: 2250
Joined: 04 Mar 2008, 23:35
Gender: Male
phpBB Knowledge: 10

Re: [Tutorial] Integrate your website around phpBB3

Postby Zappien » 12 Oct 2009, 18:31

i never touched any file in the forums directory. ( phpBB3 ) All i did is my own piece of code where it does look my personnel.user_id = phpbb_sessions.session_user_id. Do you want the full sql to check if there is anything wrong?
Zappien    
Crewman
Crewman
 
Posts: 7
Joined: 10 Oct 2009, 04:42
Gender: Male
phpBB Knowledge: 6

Re: [Tutorial] Integrate your website around phpBB3

Postby Cokez » 17 Dec 2009, 13:43

What files do I need to include or code do I need to use, in order for my html to be able to use IF statements such as if a user is logged in or out, or call variables from include/functions.php. None of them work with any of the integration tutorials I've tried, and I believe common.php is already supposed to be calling includes/functions.php, so I'm lost.
Cokez
Crewman
Crewman
 
Posts: 3
Joined: 17 Dec 2009, 04:46
Gender: Male
phpBB Knowledge: 2

Re: [Tutorial] Integrate your website around phpBB3

Postby Highway of Life » 18 Dec 2009, 02:53

The HTML files have to run through the template system for them to be able to process that kind of logic. Look up $template->set_custom_template and then you have to put your HTML files in that directory and call the template file via $template->set_filenames in your PHP controller. The first post in this topic does contain details as to how to do that.
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: [Tutorial] Integrate your website around phpBB3

Postby Cokez » 19 Dec 2009, 13:39

I'm setting the templates fine, what I mean is, how do I get different template variables such as {NEWEST_USER} (show the newest user to sign up) to work. Everything I use comes up blank. I was told to run the page_header() function, but it just gives errors when I do.
Cokez
Crewman
Crewman
 
Posts: 3
Joined: 17 Dec 2009, 04:46
Gender: Male
phpBB Knowledge: 2

Re: [Tutorial] Integrate your website around phpBB3

Postby SamT » 19 Dec 2009, 14:36

to make template vars available to be called like {NEWEST_USER}, you must run them through one of two methods:
Code: Select all
$template->assign_var('NEWEST_USER'$newest_user); 
This assigns a single template variable.
Many times, you will want to assign multiple, which then you would run this:
Code: Select all
$template->assign_vars(array(
        
'NEWEST_USER'    => $newest_user,
        )); 
you can have as many elements to this array as you want. I always use the array version of this because you can always go back and add them later with more ease.

Regarding the page header, we can't help you much unless you tell us what errors you are getting.
User avatar
SamT    
phpBB Team Member
phpBB Team Member
 
Posts: 33
Joined: 27 Jan 2009, 01:42
Favorite Team: SF 49ers
Gender: Male
phpBB Knowledge: 9

Re: [Tutorial] Integrate your website around phpBB3

Postby Cokez » 19 Dec 2009, 20:39

I already ran the variables manually in the actual file I'm testing on and nothing still shows.

Here's my header error:

[phpBB Debug] PHP Notice: in file .........includes/website_class.php on line 129: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file .........includes/website_class.php on line 131: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file .........includes/website_class.php on line 132: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file .........includes/website_class.php on line 133: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
Cokez
Crewman
Crewman
 
Posts: 3
Joined: 17 Dec 2009, 04:46
Gender: Male
phpBB Knowledge: 2

PreviousNext

Return to Tutorials and How-Tos

Who is online

Users browsing this forum: MSNbot Media and 4 guests