graham23s Posted August 15, 2007 Share Posted August 15, 2007 Hi Guys, i have a few smilies in a 2d array but im not to sure how to use them, say a user wants to add a smillie in a private message what would be the best way to call them from the array? thanks guys Graham Quote Link to comment https://forums.phpfreaks.com/topic/65027-smillies-in-textareas/ Share on other sites More sharing options...
SkyRanger Posted August 15, 2007 Share Posted August 15, 2007 This more a javascript problem. I had this problem a while ago. But here is a small example of what I have. http://www.phpfreaks.com/forums/index.php/topic,143516.0.html I will post some more code example in a few hours. Off to bed now. But that links should get you started. Quote Link to comment https://forums.phpfreaks.com/topic/65027-smillies-in-textareas/#findComment-324529 Share on other sites More sharing options...
graham23s Posted August 15, 2007 Author Share Posted August 15, 2007 oh so it is totally javascript controlled? i see i downloiaded a script a few days ago but there was no javascript involved purely php cheers Graham Quote Link to comment https://forums.phpfreaks.com/topic/65027-smillies-in-textareas/#findComment-324905 Share on other sites More sharing options...
SkyRanger Posted August 15, 2007 Share Posted August 15, 2007 This should be in the Javascript section: <SCRIPT LANGUAGE='JavaScript'> <!-- function Smiles(which) { document.post.omsg.value = document.post.omsg.value + which; } //--> </SCRIPT> <textarea name="omsg" cols="50" rows="6"></textarea> <A HREF="javascript:Smiles('')"><img src="../images/smilies/timeout.gif" BORDER=0 alt=""></A> This is just an example. You will have to make some small changes of your own for it to work. Quote Link to comment https://forums.phpfreaks.com/topic/65027-smillies-in-textareas/#findComment-325155 Share on other sites More sharing options...
SkyRanger Posted August 15, 2007 Share Posted August 15, 2007 Forgot to add this for the output $message = nl2br($omsg); include "replacesmile.inc"; echo $message; The replacesmile.inc includes this: $message = str_replace("", "<IMG SRC='../images/smilies/smiley.gif'>", $message); Quote Link to comment https://forums.phpfreaks.com/topic/65027-smillies-in-textareas/#findComment-325207 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.