How can I make the text property render html?

Last post 06-05-2011, 9:44 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  06-05-2011, 12:46 PM 67811

    How can I make the text property render html?

    I'm talking about this:
    $editor->Text="$message";
     
    If my $message contains html, how can I make the html render?  Because currently it doesn't, it just shows the html tags in the post.  I need this for when users go to edit their posts.
  •  06-05-2011, 9:44 PM 67812 in reply to 67811

    Re: How can I make the text property render html?

    Hi davideo7,
     
    You should encoding you html and than paste into editor.
     
    Please try the example below.
     
    <?php include_once("cuteeditor_files/include_CuteEditor.php") ; ?>
    <html>    
        <head>
            <link rel="stylesheet" href="php.css"  type="text/css" />
        </head>
        <body>
            
            <form name="theForm" action="Get_HtmlContent.php" method="post" ID="Form1">
                        
            <h1>Enable All Toolbars</h1>
            
            <p>This example shows you all the predefined buttons. </p>
            <br />
            <?php
                $editor=new CuteEditor();
                $editor->ID="Editor1";
                $editor->Text="Type here";
                $editor->EditorBodyStyle="font:normal 12px arial;";
                $editor->EditorWysiwygModeCss="php.css";
                $editor->Draw();
                $editor=null;
                
                //use $_POST["Editor1"]to retrieve the data
            ?>
            <input type="button" value="Encoding" onclick="ecding()" />
            </form>
        </body>
    </html>
    <script>
    function ecding()
    {
     
        var editor1 = document.getElementById('CE_Editor1_ID');
        var code="<div>test</div>";
        code= code.split("&").join('&amp;').split('<').join('&lt;').split('>').join('&gt;');
        editor1.setHTML(code);
    }
    </script>
     
     
    Regards,
     
    ken
View as RSS news feed in XML