2013-04-03 64 views
0

我想将我的phpbb3论坛中的特定帖子整合到我网站的其他区域。格式化从phpbb3数据库中提取的帖子数据

我已经写了sql代码来隔离正确的帖子,并提出正确的帖子,但它出来作为一个巨大的杂乱的字符串。

phpbb3类中的内部方法将数据库中的长混乱字符串格式化为打开论坛时查看的格式正确的帖子,包括显示附加图像。

我正在做这个与PHP。

感谢

回答

1

我相信我以前的答案,略作修改的一个,可以为您提供您所需要的信息。

Display the 5 most recent posts on an external page

简短的回答你的问题是,这一块的代码。这将清理数据的各个方面。

 $topic_title  = $posts_row['topic_title']; 
    $post_author  = get_username_string('full', $posts_row['poster_id'], $posts_row['username'], $posts_row['user_colour']); 
    $post_date   = $user->format_date($posts_row['post_time']); 
    $post_link  = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p=" . $posts_row['post_id'] . "#p" . $posts_row['post_id']); 

    $post_text = nl2br($posts_row['post_text']); 

    $bbcode = new bbcode(base64_encode($bbcode_bitfield));   
    $bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']); 

    $post_text = smiley_text($post_text); 

正如我在以前的答案提到,该代码是基于Example 4的PHPBB的Wiki。