x2i Posted April 20, 2010 Share Posted April 20, 2010 Hi, I am in a spot of bother with the way smilies are dealt with in PHPBB. I am using a function to convert BBCode into HTML where necessary by using preg_replace and it works fine, however I cant figure out how to use preg_replace to display the smilies when a user uses one. Here is the text that is output when a smilie is used: <!-- s:) --><img src="{SMILIES_PATH}/001.png" alt="" title="Smile"><!-- s:) --> I have been using the following although it is not working and I am wondering if someone can either point out where I have gone wrong or provide me with a solution to my problem - thankyou $var = preg_replace('/\<!-- .*? --><!-- sg src="{SMILIES_PATH}\/(.*?)" alt=".*?" title=".*?" \/><!-- .*? -->/is', '<img src="http://www.xboxresource.com/forum/images/smilies/$1" />',$var); -EDIT- I fixed it, I simply used the following to replace {SMILIES_PATH} with the actual url and it worked - sorry for wasting your time $var = str_replace("{SMILIES_PATH}","http://www.xboxresource.com/forum/images/smilies/",$var); Link to comment https://forums.phpfreaks.com/topic/199089-help-encoding-smilies-text/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.