PHP Classes

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of chema garrido  >  PHP BBCode  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example usage
Class: PHP BBCode
Format text with BBCode tags as HTML
Author: By
Last change:
Date: 3 years ago
Size: 2,094 bytes


Class file image Download
if ($_POST)
//parses posted BBcode to HTML
$html_code = bbcode::tohtml($_POST['description'],TRUE);
//removes the bbcode
$nobbcode = bbcode::remove($_POST['description']);

<!doctype html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>bbcode example</title>
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]> <script type="text/javascript" src=""></script> <![endif]-->
<link rel="stylesheet" href="" type="text/css" media="all" />

    <div style="margin:0 auto 0 auto;width:900px;">
    <h1>PHP BBcode parser.</h1>
    <form action="" method="post">
        <textarea name="description" id="description" style="width: 100%; height: 400px"><?=$_POST['description']?></textarea>
        <input type="submit" value="Convert to HTML" />

<h4>Parsed HTML</h4>
<h4>HTML source code</h4>
        <textarea style="width: 100%; height: 100px"><?=$html_code?></textarea>
        <h4>Posted BBcode</h4>
        <textarea style="width: 100%; height: 100px"><?=$_POST['description']?></textarea>
        <h4>Remove BBcode</h4>
        <textarea style="width: 100%; height: 100px"><?=$nobbcode?></textarea>

    <p>This example uses the super nice WYSIWYG JQuery BBcode <a href="">SCEditor</a></p>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
            toolbar: "bold,italic,underline,strike,|left,center,right,justify|" +
            resizeEnabled: "true"