display HTML content from database with formatting in it

Posted by Gaurav Sharma on Stack Overflow See other posts from Stack Overflow or by Gaurav Sharma
Published on 2010-05-25T09:39:40Z Indexed on 2010/05/25 10:01 UTC
Read the original article Hit count: 314

Hi all,

I have used wmd-editor in my cakephp v1.3 application.

The config which I have written is as follows:


wmd_options = {
            output: "HTML",

            lineLength: 40,

            buttons: "bold italic | link blockquote code image | ol ul heading hr",

            autostart: true
        };

When I submit the form the HTML in the wmd enabled textarea is saved in the database with htmlentities() done to the text then I am displaying it with html_entity_decode() method.
but the text is displayed as it is including the HTML coding like this

<p><strong>hello dear friends</strong></p>\n\n<pre><code>I want to make sure that everything that you type is visible clearly.\nadasfafas\n</code></pre>\n\n<blockquote>\n <p>sadgsagasdgxcbxcbxc</p>\n</blockquote>\n\n<p><em>sadfgsgasdsgasgs</em></p>\n\n<p><b><a href="http://kumu.in">this is the link</a></b></p>

Please help me solve this problem

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about cakephp