[b][i] buttons.. textarea

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

[b][i] buttons.. textarea

Post 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]
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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.
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post 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
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post 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...
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Haha, yeah I suppose your right there :D
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post 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.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Actually the HTMLArea is pretty slick. It has a great support network and is very customizable. Give it a try....
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

I did,, messed with it a couple of hours.. cant get it to work.. keep getting error documentall[...] is emtpy
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

give their forum a try. It may help you.

http://www.interactivetools.com/forum/f ... i?forum=18;
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

you could..................

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

:wink:
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post 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>
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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 ;)
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post 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
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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.
Post Reply