Location: PHPKode > projects > Modular Site Manager > htdocs/inc/HTML/BBCodeParser/example/parser.php

/* adjust include_path to include PEAR */
ini_set('include_path', ini_get('include_path').':/usr/share/pear');

/* all your errors are belong to us */

/* require PEAR and the parser */

/* get options from the ini file */
$config = parse_ini_file('BBCodeParser.ini', true);
$options = &PEAR::getStaticProperty('HTML_BBCodeParser', '_options');
$options = $config['HTML_BBCodeParser'];

/* do yer stuff! */
$parser = new HTML_BBCodeParser();
$parsed = $parser->getParsed();

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>HTML_BBCodeParser (by Stijn de Reede)</title>
<form method='get' action='parser.php'>
<table border='1' cellpadding='5' cellspacing='0'>
<tr><td valign='top'>
<textarea cols='45' rows='10' name='string'><?=@$_GET['string']?></textarea><br>
<td valign='top'>
<textarea cols='45' rows='10'><?=htmlentities($parsed, ENT_QUOTES)?></textarea><br>
<tr><td valign='top' colspan='2' align='center'>
<input type='submit' value='          parse          '><br>
<tr><td valign='top' colspan='2'>
<td colspan='2'>
possible codes:

[color=blue]blue text[/color]
[size=18]the size of this text is 18pt[/size]
[font=arial]different font type[/font]
[align=right]yes, you're right, this isn't on the left[/align]
he said: [quote=http://www.server.org/quote.html]i'm tony montana[/quote]
[code]x + y = 6;[/code]

[url=http://www.server.org target=new]server[/url]

[email=hide@address.com]mail me[/email]

[img w=100 h=200]http://www.server.org/image.jpg[/img]

[*]unordered item 1
[*]unordered item 2
[*]unordered item 1
[*]unordered item 2

[*]ordered item 1
[*]ordered item 2
[*]ordered item 1 type i
[li=4]ordered item 4 type i[/li]
[*]ordered item 1 type I
[list=a s=5]
[li]ordered item 5 type a[/li]
[*]ordered item 6 type a
[li]ordered item 1 type A[/li]
[li=12]ordered item 12 type A[/li]

[list=A s=3]
[li]ordered item 1, nested list:
    [li]nested item 1[/li]
    [li]nested item 2[/li]
[li]ordered item 2[/li]
Return current item: Modular Site Manager