phpBB Parsing forum post

Show off new creations, get help, or just chat about all aspects of web development and design.

phpBB Parsing forum post

Postby Garrador on Thu Jul 28, 2011 9:44 pm

Hia!

I'm trying to get together a good system for parsing forum news posts to the main frontpage, much like this one.
I'd need info from the post such as: Forum-post title, message, composer, and date/time of composing and a link to comments plus number of comments (replied posts).

Just not quite sure where to get started, or exactly how to integrate it. I've googled tons of phrases, but havent really hit anything I "understand" yet :P

Any help would be appreciated :)

Gar.
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: phpBB Parsing forum post

Postby zombie@computer on Fri Jul 29, 2011 4:01 pm

The main site uses a custom phpbb parser, i found the phpbb forum post parser way to bloated for my taste.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: phpBB Parsing forum post

Postby Garrador on Thu Aug 04, 2011 10:48 pm

Alright, I've written my parser. Encountered an issue though..

If the user session is over, or whatnot, I get the
Code: Select all
1035: Cannot modify header information - headers already sent by (index.php in this case)

error, which is from session.php, in which the set_cookie() function is trying to run and set a header.

Any ideas?
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: phpBB Parsing forum post

Postby zombie@computer on Fri Aug 05, 2011 3:58 pm

make sure that code runs before you output any text.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: phpBB Parsing forum post

Postby Garrador on Mon Aug 08, 2011 12:01 pm

I've tried to figure our just where I should look for that, without loosing what I need in the forum feed header..
Here's the code that calls the feed, and the header feed
index.php
Code: Select all
<?php include(".././site_header.php"); ?>
<!-----------CONTENT WRAPPER----------------------->
<div class="content left">
<!-- LEFT ALIGN ARTICLES -->
<article class="article_news left">
     <?php include(".././feeds/forum_feed.php"); start_feed(48, 5, false); ?>
</article>
......


forum feed header
Code: Select all
<?php
  define('IN_PHPBB', true);
  $path = $_SERVER['DOCUMENT_ROOT'];
  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../forums/';
  $smilies_path = (defined('SMILIES_PATH')) ? SMILIES_PATH : $path.'../forums/images/smilies/';
  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  include($phpbb_root_path . 'common.' . $phpEx);
  include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
  include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
  include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);

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

....



Then, if I just visit the forum, w/o logging in in any way, the header error is gone. So obviously need to run some header stuff on the forum first.. Any pointers?
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: phpBB Parsing forum post

Postby zombie@computer on Mon Aug 08, 2011 4:17 pm

Not sure. For interlopers ive written my own session and database classes, couldnt be arsed to use phpbb's because that means including a few thousand files to do even the simplest of tasks.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: phpBB Parsing forum post

Postby Garrador on Wed Aug 10, 2011 8:55 pm

Okay... that sucks, hehe. Havent figured it out yet, but I still know that this function fucks stuff up when it does the header call at the end

Code: Select all
function set_cookie($name, $cookiedata, $cookietime)
{
global $config;

$name_data = rawurlencode($config['cookie_name'] . '_' . $name) . '=' . rawurlencode($cookiedata);
$expire = gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime);
$domain = (!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain'];

header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . '; HttpOnly', false);
}


in which
header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . '; HttpOnly', false);

introduces the problem. Is there any way of maybe running this first, only once? You dont need to login to the forum to get rid of the problem, only visit it and let it run..
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: phpBB Parsing forum post

Postby Garrador on Thu Aug 11, 2011 1:15 am

Alright, I did find one solution, but idk if it's the best way. So, I'll consult you (guess that means you zombie@comp ;) ):

I added the phpbb header info in my cusomt header, instead of in the forum feed file.
My concern though; each page includes this header (i.e: contact, about, home, etc). Will there be some kind of overhead or replica session stuff when the user browses the site?
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: phpBB Parsing forum post

Postby zombie@computer on Thu Aug 11, 2011 4:08 pm

what 'header info'?
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: phpBB Parsing forum post

Postby Garrador on Thu Aug 11, 2011 8:03 pm

zombie@computer wrote:what 'header info'?

Well, info might be the wrong word, yes. Header code for phpbb.

This is what I added to my header that runs on every page:

Code: Select all
define('IN_PHPBB', true);
  $path = $_SERVER['DOCUMENT_ROOT'];
  $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../forums/';
  $smilies_path = (defined('SMILIES_PATH')) ? SMILIES_PATH : $path.'../forums/images/smilies/';
  $phpEx = substr(strrchr(__FILE__, '.'), 1);
  include($phpbb_root_path . 'common.' . $phpEx);
  include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
  include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
  include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);

  // Start session management
  $user->session_begin();
  $auth->acl($user->data);
  $user->setup('viewforum');
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: phpBB Parsing forum post

Postby zombie@computer on Thu Aug 11, 2011 9:32 pm

well, you are including a shitload of php files. Sure, servers nowadays should have no problems with that, but for a busy site's frontpage you might want to write your own code.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: phpBB Parsing forum post

Postby Garrador on Sat Aug 13, 2011 11:54 am

Yeah I was worried about something like that. Well, I totally forgot to actually recheck, after some edits I made, if I even needed all the includes. Now
Code: Select all
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);


is removed. Do you think that is good enough, for now atleast, until I've gotten around to writing my own stuff..?

Are there any good sites for testing site loading times? Found a few, but seemed borky..
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Return to Web Design & Development

Who is online

Users browsing this forum: No registered users