Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-26-2009, 07:52 PM
bigtime bigtime is offline
 
Join Date: Jun 2002
Location: Houston, Texas
Posts: 171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Parse BBCODE on non-VB page?

Hi,

Using 3.8 and trying to parse bbcode on a non-vb page at
http://www.defend.net/activetopic-new.php

Could someone please let me know how to correct this code so that the bbcode will be parsed? I've already searched and read and tried some things but couldn't get it working.

PHP Code:
<?php
  $cwd = getcwd();
    chdir('./deluxeforums');
    require_once('./global.php');
    require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());

$num_active = 5;
    $num_topicchars  = 110;

     $db=mysql_connect("localhost","user","pass");
    mysql_select_db("database");

    $querylatest="select * from thread where forumid='1' or forumid='2' or forumid='3' or forumid='4' or forumid='5' or forumid='6' or forumid='7' or forumid='10' or forumid='11' or forumid='12' or forumid='13' or forumid='14' or forumid='15' or forumid='16' or forumid='17' or forumid='18' or forumid='19' or forumid='20' or forumid='22' or forumid='23' or forumid='25' or forumid='26' or forumid='27' or forumid='28' or forumid='29' or forumid='30' or forumid='31' or forumid='32' or forumid='34' or forumid='35' or forumid='36' or forumid='37' or forumid='38' order by lastpost desc limit $num_active";

    $resultlatest = mysql_query($querylatest,$db);
?>

<table width="100%" align="center" cellpadding="2" cellspacing="0">
  <?php
    while ($latest_array = mysql_fetch_array($resultlatest)) {

    // Get Forum Infomation
    $query_forum = "select * from forum where forumid='$latest_array[forumid]'";    
    $result_forum = mysql_query($query_forum,$db);
    $forum_info_array = mysql_fetch_array($result_forum);

        // split the date up a bit
        $datestr1 = substr($latest_array["dateline"],0,10);
    $datetime = substr($latest_array["dateline"],11,8);
?>
  <tr>
    <td align="left"><b class="rightTxt1"><?php echo $forum_info_array["title"]; ?>:<br />
      <?php echo $latest_array["title"]; ?></b></td>
  </tr>
  <?php
    $querythread="select * from post where threadid='$latest_array[threadid]' order by dateline desc limit 1";
    $result_thread_text= mysql_query($querythread,$db);
    $result_thread_array = mysql_fetch_array($result_thread_text);
    $pagetext = substr(strip_tags($result_thread_array[pagetext]),0,$num_topicchars);


$pagetext = $bbcode_parser->do_parse("$pagetext", false, true, true, true, true, false)

    ?>
  <tr>
    <td width="100%"><p align="left" class="rightTxt1"><img src="/deluxeforums/images/statusicon/forum_new.gif" alt="New Forum Post" /> <?php echo "$pagetext"; ?>... <a href="/deluxeforums/showthread.php?threadid=<?php echo "$latest_array[threadid]"; ?>">(more)</a></p>
      <p align="left"  class="rightTxt1">Started By: <?php echo "$latest_array[postusername]"; ?> <br />
        Last Post By: <?php echo "$latest_array[lastposter]"; ?> </p>
      <hr align="center" width="80%" /></td>
  </tr>
  <?php 
}
?>
</table>
Reply With Quote
  #2  
Old 01-27-2009, 03:17 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This line is stripping out all the BB code:
PHP Code:
$pagetext = substr(strip_tags($result_thread_array[pagetext]),0,$num_topicchars); 
Use:
PHP Code:
$pagetext = substr($result_thread_array['pagetext'], 0, $num_topicchars); 
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:10 PM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.