TinyMce integration with codeigniter |
[eluser]Terence Bruwer[/eluser]
Hi all. I realise that this topic has been covered numerous times. But I am truly stuck on this one. I have tried ckeditor, openwysiwyg and tinymce text editors. They all save to my mysql database with the html tags intact ie: Code: <p>another post</p> when i go retrieve my data and display it in the texteditor for editing it is showing the html tags. I have read through numerous posts and tried everything I have come across. I realise I must be missing something obvious within my codeigniter coding, as it is doing this with all the editors that I tried. So the problem is not editor specific. a quick update. using standard php files. i would prep my database field value as follows: Code: mysql_real_escape_string(htmlentities($_POST["details"])); to retrieve and display it was just doing: Code: <textarea rows="15" cols="60" name="details" id="details" class="required"><?php echo $details;?></textarea> Please any help would be appreciated on this one
[eluser]noslen1[/eluser]
You should not use the htmlentities() function, as it converts all html characters. Just Code: mysql_real_escape_string($_POST["details"]);
[eluser]Terence Bruwer[/eluser]
I am not currently using htmlentities in my codeigniter controller. And will confess to getting very confused with all the encode, decodes etc. I came across this thread which is exactly what is happening to me http://ellislab.com/forums/viewthread/141495/ in short the following seems to be happening I think. Active Record, AR escapes converts html tags to text for security. thank you very much for the reply
[eluser]Terence Bruwer[/eluser]
I have managed to get this resolved using ckeditor, It is a problem with the form helper class. I will post a fix later this afternoon once I have tested it thoroughly
[eluser]mx_code_monkey[/eluser]
have you thought about using php's serialize() and unseralize() functions? I think it would be very useful for saving potentially code-embedded string data in a database. base64encode and base64decode could also work, although it increases the data size, it would be a preventive precaution if any of the data is MIME encoded as an image.
[eluser]mx_code_monkey[/eluser]
I also suspect that customized disaply of specific tags would be done using preg_match and preg_replace regular expressions after rich text objects are submitted and before they are displayed if you want certain tags to remain but others not to.. |
Welcome Guest, Not a member yet? Register Sign In |