Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/144291-not-sure-how-to-do-this/
Share on other sites

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.

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.