kevinritt Posted February 8, 2009 Share Posted February 8, 2009 I have this code that someone wrote for me function bbcode(open, end){ var tArea = document.description.description; var isIE = (document.all)? true : false; var open = (open)? open : ""; var end = (end)? end : ""; if(isIE){ tArea.focus(); var curSelect = document.selection.createRange(); if(arguments[2]){ curSelect.text = open + arguments[2] + "]" + curSelect.text + end; }else{ curSelect.text = open + curSelect.text + end; } }else if(!isIE && typeof tArea.selectionStart != "undefined"){ var selStart = tArea.value.substr(0, tArea.selectionStart); var selEnd = tArea.value.substr(tArea.selectionEnd, tArea.value.length); var curSelection = tArea.value.replace(selStart, '').replace(selEnd, ''); if(arguments[2]){ tArea.value = selStart + open + arguments[2] + "]" + curSelection + end + selEnd; }else{ tArea.value = selStart + open + curSelection + end + selEnd; } }else{ tArea.value += (arguments[2])? open + arguments[2] + "]" + end : open + end; } } and I have this code: function ValidateOutput($value) { $BBCode = array( " [center]" => "<center>", "[/center] " => "</center>", "[b]" => "<b>", "[/b]" => "</b>", "[u]" => "<u>", "[/u]" => "</u>", "[i]" => "<i>", "[/i]" => "</i>", "[*]" => "<li>", "" => "</li>", ); $value = str_replace(array_keys($BBCode), array_values($BBCode), $value); $value = stripslashes(nl2br($value)); return $value; } I'd like to add the ability to change the font color, font style, and upload images. I've been looking at this code and I am not experienced enough to know how to add the mentioned features. Can someone give me a clue as to where to go for help? Forums, tutorials, etc Quote Link to comment https://forums.phpfreaks.com/topic/144291-not-sure-how-to-do-this/ Share on other sites More sharing options...
RichardRotterdam Posted February 8, 2009 Share Posted February 8, 2009 I'd like to add the ability to change the font color, font style, You'll need javascript for that. These are typical Rich Text Editor functionalities. Try an existing one like Fckeditor, Tinymce or lookup tutorials how to build one yourself and upload images. I see that the second code block is written in php. You can use php to upload a form. Quote Link to comment https://forums.phpfreaks.com/topic/144291-not-sure-how-to-do-this/#findComment-757352 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.