...

View Full Version : posting system



boeing747fp
05-20-2004, 09:20 PM
i have admin panel systems set up on over 12 sites and i would love to learn how to make a "page edit" box like this one im typing in right now that you can just click B for Bold text, change colors, etc.... but i dont know where to get the javascript info to make all these [B] tags to get put in when i click the B button... can anyone help me?

stophon4
05-20-2004, 09:58 PM
You should give more information, for example if you are just wanting to insert a bbcode into the text box it is very simple, but I you will need some php code to replace, I did it very simply on my Guestbook (http://www.hostultra.com/~stophon4/guestbook/gb.php), you can download it and look at the source, but just to give you a quick example:


// the javascript code to insert to the textarea
<SCRIPT>
function addb()
{
document.formname.textareaname.value += "[ b ] [/ b ]" //spaces in tags because of forum bbcode
}
</SCRIPT>

that will do the javascript, to call that code from a button:


<INPUT type='button' Value='B' Onclick="addb()" style="font-weight: bold">

the font-weight: will make the button bold,
and to turn it into html for your admin panel
you can use preg_replace e.g.


$_POST['comments'] = preg_replace("/\[b\]/","<strong>",$_POST['comments']);
$_POST['comments'] = preg_replace("/\[\/b\]/","</strong>",$_POST['comments']);

that's the code I use, and btw <strong> is the same as <b> basically,
I am not really sure if that is what you wanted but it is my best guess..

boeing747fp
05-20-2004, 10:27 PM
i was already planning on doing that... but what about the actual script on the buttons that add the [B] to the text area im typing in. thanks

firepages
05-21-2004, 01:04 PM
google for 'htmlarea' V3 is x-browser and free , likea hotmail editor but without relying on MS stuff (so works on linux and 1 day Mac they reckon?)

stophon4
05-22-2004, 12:44 AM
i was already planning on doing that... but what about the actual script on the buttons that add the [B] to the text area im typing in. thanks
I already posted it:


// the javascript code to insert to the textarea
<SCRIPT>
function addb()
{
document.formname.textareaname.value += "[ b ] [/ b ]" //spaces in tags because of forum bbcode
}
</SCRIPT>

Read my post next time ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum