gaogier Posted June 3, 2008 Share Posted June 3, 2008 This code gets data from a phpbb3 mysql database It shows all the first posts in one forum I now need this code to use bbcode, loads of people have told me many different ways. i have now given up doing it myself, can anyone help? <p> <?php //function displayNews($all = 0) { //global $sitestyle; require_once ('../mysql_connect1.php');//connect to db if ($all == 0) { $topic_query = "SELECT * FROM `phpbb_topics` WHERE `forum_id`= '63' ORDER BY `topic_time` DESC LIMIT 1"; // do topic query }else{ $topic_query = "SELECT * FROM `phpbb_topics` WHERE `forum_id`= '63' ORDER BY `topic_time` DESC"; // do topic query } $topic_result = mysql_query ($topic_query); while ($topic_row = mysql_fetch_assoc($topic_result)) { $tt = $topic_row['topic_time']; $topic = $topic_row['topic_id']; $poster = $topic_row['topic_poster']; $first = $topic_row['topic_first_post_id']; $title = $topic_row['topic_title']; $topic_replies = $topic_row['topic_replies']; $topic_runescape = $topic_row['topic_runescape']; $post_query = "SELECT * FROM `phpbb_posts` WHERE `topic_id` = '$topic' AND `poster_id` = '$poster' AND `post_id` = '$first'"; // do post subject query $post_result = mysql_query($post_query); while ($post_row = mysql_fetch_assoc($post_result)){ $post_id = $post_row['post_id']; } $use_query = "SELECT `username`, `user_avatar`, `user_email`, `user_rank` FROM `phpbb_users` WHERE `user_id` = '$poster'"; // do user query $use_result = mysql_query($use_query); while ($use_row = mysql_fetch_assoc($use_result)){ $user = $use_row['username']; $user_avatar = $use_row['user_avatar']; $user_email = $use_row['user_email']; $rank = $use_row['user_rank']; } $news_query = "SELECT `post_text` FROM `phpbb_posts` WHERE `post_id`='$post_id'"; $news_result = mysql_query($news_query); while ($news_row = mysql_fetch_assoc($news_result)){ $news = $news_row['post_text']; } $rank_result = mysql_query("SELECT `rank_title` FROM `phpbb_ranks` WHERE `rank_id`='$rank'"); while($rank_row = mysql_fetch_assoc($rank_result)){ $ranks = $rank_row['rank_title']; } $date = date("D M jS, Y g:i a", $tt); if ($topic_replies == 0){ $reply = '<a href="http://www.runehints.com/phpBB3/posting.php?mode=reply&f=63&t='.$topic.'">Nobody has commented on this piece of news yet. Be the first!</a>'; $post_new =""; }else{ $reply = 'comments(<a href="http://www.runehints.com/phpBB3/viewtopic.php?t='.$topic.'">'.$topic_replies.'</a>) |'; $post_new = '<a href="http://www.runehints.com/phpBB3/posting.php?mode=reply&f=63&t='.$topic.'">Post a comment</a>'; } if ($topic_runescape == 1){ $news1 = 'This news topic is taken straight from <a href="http://runescape.com">Runescape.com</a><br />_____________________________________________<br /><br />'.$news; }else{ $news1 = $news; } // Replace newlines // $news2 = str_replace("\n", "\n<br />\n", $news1); ?> <ul class="list1"><li> <table width="100%" border="0"> <tr> <td><center><a href="http://www.runehints.com/phpBB3/viewtopic.php?t=<?php echo $topic; ?>" class="news"><?php echo $title; ?></a> posted by <a href="http://www.runehints.com/phpBB3/memberlist.php?mode=viewprofile&u=<?php echo $poster; ?>"><?php echo $user; ?></a> on <?php echo $date;?></center> </td> </tr> <tr> <td><table width="100%" border="0"> <tr> <td width="20%" valign="top"><center> <img src="<?php echo $user_avatar; ?>" ><br /><font class="small2"><?php echo $ranks; ?></font></center> </td> <td width="80%"> <p><font class="small2"> <p><?php echo "$news2"; ?></p><br> <br /><center><font class="small2"><?php echo $reply. ' '. $post_new;?></font></center> </div><br /></td> </tr> </table></td> </tr> </table></li> </ul> <?php } /* if we aren't displaying all news, * then give a link to do so */ if ($all == 0) { echo "<center><a href=\"{$_SERVER['PHP_SELF']}" . "?action=all\">View all news</a></center>\n"; } //mysql_close(); //} ?> Link to comment https://forums.phpfreaks.com/topic/108606-news-needs-to-use-bbcode-help/ Share on other sites More sharing options...
gaogier Posted June 4, 2008 Author Share Posted June 4, 2008 can anyone help? Link to comment https://forums.phpfreaks.com/topic/108606-news-needs-to-use-bbcode-help/#findComment-557859 Share on other sites More sharing options...
DarkWater Posted June 4, 2008 Share Posted June 4, 2008 Just use the phpBB3 BBCode parser, lol. Link to comment https://forums.phpfreaks.com/topic/108606-news-needs-to-use-bbcode-help/#findComment-557866 Share on other sites More sharing options...
gaogier Posted June 4, 2008 Author Share Posted June 4, 2008 how do i add that to my script... everything i have tried has failed... no idea why... Link to comment https://forums.phpfreaks.com/topic/108606-news-needs-to-use-bbcode-help/#findComment-557883 Share on other sites More sharing options...
DarkWater Posted June 4, 2008 Share Posted June 4, 2008 Just include the phpbb3 bbcode parser class file and use it. Link to comment https://forums.phpfreaks.com/topic/108606-news-needs-to-use-bbcode-help/#findComment-557893 Share on other sites More sharing options...
discomatt Posted June 4, 2008 Share Posted June 4, 2008 Also theres a PEAR module and PECL class available for parsing bbcode Link to comment https://forums.phpfreaks.com/topic/108606-news-needs-to-use-bbcode-help/#findComment-557904 Share on other sites More sharing options...
DarkWater Posted June 4, 2008 Share Posted June 4, 2008 But phpBB3 has a BBCode parser, so it's probably a better bet to use the phpBB parser on phpBB BBCode. Link to comment https://forums.phpfreaks.com/topic/108606-news-needs-to-use-bbcode-help/#findComment-557909 Share on other sites More sharing options...
gaogier Posted June 4, 2008 Author Share Posted June 4, 2008 how would i add this to my script? Link to comment https://forums.phpfreaks.com/topic/108606-news-needs-to-use-bbcode-help/#findComment-557921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.