vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Parse BBCode (in 3.5) (https://vborg.vbsupport.ru/showthread.php?t=82693)

hellbringer80 09-05-2008 03:53 AM

Wow great man, thanks, very useful!

tuursw 09-26-2008 10:58 AM

i want to use a script outside of the folder where the forum is installed, but when i include the global.php with "require_once('forum/global.php');" the my script doesn't works anymore..?

Do i need to include anything else which has the reference to the folder or so?

(when i put my script in the forum folder is seems to work fine)

BlackxRam 10-12-2008 10:52 AM

in 3.6 how can I get BBcode and Line Breaks to work properly in the Profile Pages? Especially in Custom Fields?

MTGDarkness 02-28-2009 09:27 AM

Two questions.
1. Does this work with 3.7.x?
2. What's the right syntax to make $text the combination of three variables? I have this right now:
Code:

if ($post[field11] && $post[field12])
{
require_once(DIR . '/includes/class_bbcode.php');
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$parsed_text = $parser->do_parse($text, $do_html, $do_smilies, $do_bbcode, $do_imgcode, $do_nl2br, $cachable); 

$text = $post[field11].$message.$post[field12];
}

And in the postbit template, I intend to use a conditional to replace $message with $parsed_text if both fields are filled in. However, the message comes up as blank. I checked the source code and came up with just the start of the post div. I'm guessing it's because my syntax is wrong; specifically
Code:

$post[field11].$message.$post[field12]

Fox Mc Cloud 11-21-2009 10:48 AM

Quote:

Originally Posted by Andreas (Post 663634)
If you want to parse BBCodes somewhere in your hacks/scripts (assuming that global.php is already required):

PHP Code:

require_once(DIR '/includes/class_bbcode.php');
$parser =& new vB_BbCodeParser($vbulletinfetch_tag_list());
$parsed_text $parser->do_parse($text$do_html$do_smilies$do_bbcode$do_imgcode$do_nl2br$cachable); 

The parameters for method do_parse() are:
  • $text = Text to be parsed
  • $do_html = Whether to allow HTML or not (Default = false)
  • $do_smilies = Whether to parse smilies or not (Default = true)
  • $do_bbcode = Whether to parse BB code (Default = true)
  • $do_imgcode = Whether to parse the [img] BB code or not, independant of $do_bbcode (Default = true)
  • $do_nl2br = Whether to automatically replace new lines with HTML line breaks or not (Default = true)
    This should be set to false if you allow HTML.
  • $cachable = Whether the post text is cachable or not (Default = false)

All parameters except $text can be omitted and will use the defaults then.

Thanks, that was what I needed :D


All times are GMT. The time now is 11:09 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.01111 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete