Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
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($vbulletinfetch_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_textmysql_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"falsetruetruetruetruefalse)

    
?>
  <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 08:01 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03757 seconds
  • Memory Usage 2,191KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete