Okay so I'm trying to make a smilie array, problem is that it's going to be in JavaScript and I get errors because of wierd chars.
Here's my error: [17:14:57.025] SyntaxError: unterminated parenthetical Here's the code line:
var smiley_array = [':)',';)',':P',':D',':O',':(',':\'(',':|',':/',':$',':@','(A)','3:)',':cool:',':*',':lol:',':z'];
I know that in some places there must be a Backslash before the character and I've been trying with everything I can think of.
Thanks.
EDIT:
var smiley_array = [':)',';)',':P',':D',':O',':(',':\'(',':|',':/',':$',':@','(A)','3:)',':cool:',':*',':lol:',':z'];
var smiley_xhtml = ['smile','wink','raspberry','big_smile','surprise','sad','crying','plain','worried','embarrassed','angry','angel','devil','cool','kiss','laugh','tired'];
function smilies(text) {
for (var i = 0; i< smiley_array.length; i++) {
word = smiley_array[i].replace(")","\\)");
word = new RegExp(word, "g");
var smiley_img = '<img style="margin-bottom: -3px;" height="20px" width="20px" src="<?php echo $this->x7->smilie_url; ?>' + smiley_xhtml[i] + '.png" />';
text = text.replace(word, smiley_img);
}
return text;
}
Note that there's Nothing wrong with the Function it self, I've tryed it with only 1 simple smilie in the array.