Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon
Posted: 10/05/09 23:36
The add/update form for my classified Ads module, uses a textarea for the users ad content. It is BBCode Enabled. I have used the htmlBBCode() Function to convert the standard BBCode into HTML, before it is INSERT/UPDATE to the database. The issue is, that if the user clicks a smiley, it is added to the database also. When it is displayed, the Smileys are not displayed in its image form. I found a forum post for a smarty function that converts the textual smiley value into the graphical version. The smarty function, contains a hard coded version of the smileys. Does anyone have a suggestion on how to use the smiley.cfg.php $_smiley array, to convert the textual smiley to the graphical version? I don't mind using the hard coded smileys but if someone has a custom list of smileys, they wouldn't be supported in my module. Any advice would be greatly appreciated.
Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA
Posted: 10/06/09 11:06
musiccreatures:
The add/update form for my classified Ads module, uses a textarea for the users ad content. It is BBCode Enabled. I have used the htmlBBCode() Function to convert the standard BBCode into HTML, before it is INSERT/UPDATE to the database. The issue is, that if the user clicks a smiley, it is added to the database also. When it is displayed, the Smileys are not displayed in its image form. I found a forum post for a smarty function that converts the textual smiley value into the graphical version. The smarty function, contains a hard coded version of the smileys. Does anyone have a suggestion on how to use the smiley.cfg.php $_smiley array, to convert the textual smiley to the graphical version? I don't mind using the hard coded smileys but if someone has a custom list of smileys, they wouldn't be supported in my module. Any advice would be greatly appreciated.
Make sure you are saving the text with the BBCode in place - then, on display use the htmlBBCode function - i.e.
This allows the BBCode settings to be applied to a quota properly - if you convert first, and store the HTML, then later decide to NOT allow BBCode, you're stuck trying to strip the HTML from the text (and if you Allow HTML, this becomes basically impossible).
Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon
Posted: 10/06/09 21:46
Thanks for the help bigguy. I placed the htmlBBCode Function into my modules ranking script. Works like a charm. Now the BBCODE is(as the function implies) converted to its HTML equivalent. Is there a simple way to disable the list of Emoticons, from being displayed with the textareas? As of now, all the forms, in this module that have textareas(with the WYSIWYG Editor disabled) with a selection of Emoticons, under the Form Fields Title. Is there a way to prevent that list of Emoticons from being displayed but still keep the BBCode enabled?
Oh and in your example: $text = htmlBBCode($text,$_user['quota_bbcodetags']);
Wouldn't $_user['quota_bbcodetags'] refer to the current user or would it refer to the user who posted the ad?