Page 1 of 1

[b][i] buttons.. textarea

Posted: Sat Aug 07, 2004 4:07 am
by ol4pr0
I was wondering how the is done.

How do those buttons work above the textarea for example in these forums.
When click on [~B] a [b~] appears in the textarea

Can somebody let me in on that secret?[/b]

Posted: Sat Aug 07, 2004 10:11 am
by hawleyjr

Posted: Sat Aug 07, 2004 10:16 am
by hawleyjr

Code: Select all

<?php
$message = str_replace("[b]","<b>",$message); 
?>
I don't think that is what he is looking for. He needs the javascript buttons that will insert the into a text area.

Posted: Sat Aug 07, 2004 10:17 am
by Joe
Hehe, I just removed it before you had the chance to post ;) After actually reading it properly I realised where I was wrong. :P

Posted: Sat Aug 07, 2004 10:17 am
by hawleyjr
lol, I was like. Where did that go? now everytime someone reads it they are going to think I'm having a conversation with myself.... thanks...

Posted: Sat Aug 07, 2004 10:19 am
by Joe
Haha, yeah I suppose your right there :D

Posted: Sat Aug 07, 2004 11:56 am
by ol4pr0
Thanks hawleyjr.. i will try to give it a try putting something together

htmlarea.. Hmm tried that, no way i am getting that to work lol.

Posted: Sat Aug 07, 2004 11:58 am
by hawleyjr
Actually the HTMLArea is pretty slick. It has a great support network and is very customizable. Give it a try....

Posted: Sat Aug 07, 2004 12:02 pm
by ol4pr0
I did,, messed with it a couple of hours.. cant get it to work.. keep getting error documentall[...] is emtpy

Posted: Sat Aug 07, 2004 12:05 pm
by hawleyjr
give their forum a try. It may help you.

http://www.interactivetools.com/forum/f ... i?forum=18;

Posted: Sat Aug 07, 2004 1:25 pm
by tim
you could..................

download the source of get someone to send you a file to see how phpbb does it

:wink:

Posted: Sat Aug 07, 2004 1:27 pm
by tim
something along these lines:

Code: Select all

function insert(text) &#123; 
   text = ' ' + text + ' '; 
   if (document.post.comment.createTextRange && document.post.comment.caretPos) &#123; 
      var caretPos = document.post.comment.caretPos; 
      caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text; 
      document.post.comment.focus(); 
   &#125; else &#123; 
   document.post.comment.value  += text; 
   document.post.comment.focus(); 
   &#125; 
&#125; 
//--> 
</script>

Posted: Sat Aug 07, 2004 3:12 pm
by timvw
Login with webmaster/webmaster at http://home.mysth.be/~timvw/test/

Source is at http://home.mysth.be/~timvw/programming ... syform.zip

But i think htmlArea is nicer too... Should find some time to dig into that ;)

Posted: Sat Aug 07, 2004 10:23 pm
by ol4pr0
could be nice, however making one myself could be a great experience ( and a few headeggs maby lol )

ps: those links you gave are they down?

alvast bedankt

Posted: Sun Aug 08, 2004 3:03 am
by timvw
At the moment they are down :/ But when root wakes up, i'm pretty sure he'll kick the machine back in action till eternity ;)

It makes use of the Pear::HTML_BBCode package. Although i added a custom filter to have

Code: Select all

sourcecode highlight.