View Single Post
Old 01-06-2008, 03:19 PM   #1 (permalink)
Gareth
The Acquainted
 
Gareth's Avatar
 
Join Date: Jan 2008
Posts: 136
Thanks: 4
Gareth is on a distinguished road
Default Custom BBCode / WYSIWYG

Hi

A few of you might know about my SBB forum software which I am making. Well, simply put, is there an easy way I can make my own bbcode with a simple WYSIWYG editor type thing (not important, could be just input buttons which when pressed enters part of a bbcode into the text box)?

I have a static method; found on the internet:

PHP Code:
<?php 

function smilies($text){
    
     
$smilies['plaintext'] = array(":)",":D",":(");
     
$smilies['htmltext'] = array("<img src='happy.png'>","<img src='grin.png'>","<img src='sad.png'>");
     
     
$text str_replace($smilies['plaintext'],
     
$smilies['htmltext'],$text);
     
     return 
$text; }
     
    echo 
smilies("Hello bob :) :D "); 
      
    
?>
Could I just run this function through the mysql query?

Also could someone tell me how I would use the function nl2br to make it so that when the user makes a new line in the text box it puts a <br / > tag there?

Gareth.
Gareth is offline  
Reply With Quote