Shoutbox

code for inserting smilies easily - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: code for inserting smilies easily (/showthread.php?tid=53909)

code for inserting smilies easily by stoshrocket on 12-14-2005 at 07:51 PM

i want to know if there is a code you can use so that if you automatically type :) it would produce a simly image from the folder /images/smilies/smile and so on, is there a peice of code i can add to make this possible so i dont have to keep typing <img src=".... />?? thanks!


RE: code for inserting smilies easily by saralk on 12-14-2005 at 08:46 PM

in what context?

If you are talking about in php or something then

code:
$text = str_replace(":)", "<img src='images/smilies/smile.gif' />", $text);
should work.
RE: code for inserting smilies easily by Chris4 on 12-15-2005 at 01:59 AM

If it's in HTML, you can always copy and paste?
Ctrl + c ... Copy
Ctrl + v ... Paste


RE: code for inserting smilies easily by stoshrocket on 12-15-2005 at 12:16 PM

quote:
Originally posted by saralk
in what context?

If you are talking about in php or something then
code:
$text = str_replace(":)", "<img src='images/smilies/smile.gif' />", $text);
should work.

thanks, im guessing i can put this code at the head tag or iam i going to have to direct it to a php file??

quote:
Originally posted by chris4
If it's in HTML, you can always copy and paste?
Ctrl + c ... Copy
Ctrl + v ... Paste

thats what iuve been doin until now but i am using the smilies once evcery time i insert news the webpage, and there are about 10 different ones so c and v wont be that effective, thanks anyway!
RE: code for inserting smilies easily by user27089 on 12-15-2005 at 12:33 PM

quote:
Originally posted by Methos2
thanks, im guessing i can put this code at the head tag or iam i going to have to direct it to a php file??

<?PHP $text = str_replace(":)", "<img src='images/smilies/smile.gif' />", $text); ?>

I think (in the <head></head> section).
RE: code for inserting smilies easily by stoshrocket on 12-15-2005 at 03:41 PM

works a treat thanks, would i be able to direct the page to a seperate php document like you do a style sheet, or is that not possible??


RE: code for inserting smilies easily by hmaster on 12-15-2005 at 05:33 PM

Put the code into a seperate php file and in your head tag put

code:
<?php include "simlies.php"; ?>

RE: code for inserting smilies easily by stoshrocket on 12-15-2005 at 05:34 PM

thanks, thats exactly what i wanted, thanks for all your help guys!