Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Parse BBCode (in 3.5)
Andreas
Join Date: Jan 2004
Posts: 6,863

Germany
by Andreas Andreas is offline 08 Jun 2005

If you want to parse BBCodes somewhere in your hacks/scripts (assuming that global.php is already required):


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.

Last edited by Andreas; 26 Nov 2005 at 23:51..
Views: 32277
Reply With Quote
Comments
  #2  
Old 16 Jun 2005, 04:40
VBCoder VBCoder is offline
 
Join Date: Jun 2005
Can this only be used to go from BBCode --> HTML? Or can it also go from HTML --> BBCode?
Reply With Quote
  #3  
Old 16 Jun 2005, 04:43
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Real name: Andreas
Yes, Class vB_CodeParser can only be userd for BBCode -> HTML.

For limited HTML -> BBCode use convert_wysiwyg_html_to_bbcode() in functions_wysiwyg.php
Reply With Quote
  #4  
Old 16 Jun 2005, 14:44
VBCoder VBCoder is offline
 
Join Date: Jun 2005
Kirby,

Thanks. I've noticed that convert_ can handle &lt and &gt properly, but leaves &quot as &quot - not " . Any ideas?
Reply With Quote
  #5  
Old 03 Aug 2005, 04:57
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
How can I do this in vB 3.0.7?
Reply With Quote
  #6  
Old 03 Aug 2005, 06:08
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
Could this be used to fix the /me problem in quotes for 3.5 RC 1?
Reply With Quote
  #7  
Old 09 Aug 2005, 04:22
safiel's Avatar
safiel safiel is offline
 
Join Date: Mar 2002
Search is my friend.

Thanks for posting this, was looking for a hint and this saved me lots of time.
Reply With Quote
  #8  
Old 11 Aug 2005, 05:32
chanzero chanzero is offline
 
Join Date: Aug 2003
help for a noob please if i have the following...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

if i understand what this code does, i should get back something like this:

parsed text = My Review!

but i just get


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by chanzero; 11 Aug 2005 at 07:09.
Reply With Quote
  #9  
Old 11 Aug 2005, 06:57
Ky Kiske's Avatar
Ky Kiske Ky Kiske is offline
 
Join Date: Dec 2001
Real name: Anthony Jackson
How do you do this if it's like forum.yoursite.com? And that directory has a password?
Reply With Quote
  #10  
Old 30 Aug 2005, 18:44
chanzero chanzero is offline
 
Join Date: Aug 2003
Originally Posted by chanzero
help for a noob please if i have the following...


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

if i understand what this code does, i should get back something like this:

parsed text = My Review!

but i just get


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
i should note that kirby helped me figure this out by pointing out that i did not definie $do_html, $do_smilies, $do_bbcode, $do_imgcode, etc

thanks kirby!
Reply With Quote
  #11  
Old 13 Sep 2005, 23:07
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Real name: Rob
And how do you define them?
Reply With Quote
  #12  
Old 14 Sep 2005, 06:11
KingSpade KingSpade is offline
 
Join Date: Aug 2005
Originally Posted by Boofo
And how do you define them?
I must be missing something because I've yet to get this to work for me . I've got the following and I've tried just about all that I can and nothing is working for me. If anyone could help, I'd appreciate it very much.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #13  
Old 19 Sep 2005, 19:05
Brinnie's Avatar
Brinnie Brinnie is offline
 
Join Date: Jul 2005
Kirby, how would one go about adding this to the FAQ manager?
Reply With Quote
  #14  
Old 01 Oct 2005, 03:14
CapinPete CapinPete is offline
 
Join Date: Oct 2004
In my case I had to use the following code:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I am pretty much a php noob and it took me a good hour to figure this out. I guess its because I declared the parser as an object at the beginning of the script. I am using a function that gets the last 10 posts in a forum and displays it as HTML for use on the homepage. As we all SHOULD know, php requires that you declare a variable "global" if its outside your function.
Reply With Quote
  #15  
Old 10 Oct 2005, 22:52
Man1c M0g's Avatar
Man1c M0g Man1c M0g is offline
 
Join Date: Jan 2004
Well, I've fiddled with all the suggestions here for the last 2 hours and I still can't get anything to work! Here's the errors I get:

Fatal error: Call to a member function on a non-object in /home/httpd/vhosts/biorust.com/subdomains/forums/httpdocs/includes/class_bbcode.php on line 181

Fatal error: Call to a member function on a non-object in /home/httpd/vhosts/biorust.com/subdomains/forums/httpdocs/includes/functions.php on line 4308
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 01:08.

Layout Options | Width: Wide Color: