suyati / line-control

A Light Weight HTML5 Text Editor designed as a JQuery Plugin
Other
124 stars 90 forks source link

how to display from db to view page? #80

Closed Meakrothany closed 7 years ago

Meakrothany commented 7 years ago

I line-control to insert content to database and i can get it back and set content from database to editor but i don't how to display from database to view page? can you show me? i try to search a lot on internet but don't provide document to to get content to view page just tell set to editor back.

xOneca commented 7 years ago

Please, see the thread in #34, and specially one of my last comments.

Meakrothany commented 7 years ago

34 i completed it already! `$(document).ready(function(){

     $("#txtEditor").Editor("setTxt","<?php echo $data;?>");
});`

it work from me! i mean i want to display to view page not setText to editor! i want to display from db to view page all content and image to view page.

Meakrothany commented 7 years ago

This my code! $my_var="test"; $("#txtEditorContent").Editor("setText","<?php echo $my_var;?>");

and this is error Uncaught TypeError: Cannot read property 'html' of undefined at n.fn.init.setText (editor.js:1575) at n.fn.init.$.fn.Editor (editor.js:1606) at HTMLDocument.<anonymous> (437:797) at i (jquery-2.2.3.min.js:2) at Object.fireWith [as resolveWith] (jquery-2.2.3.min.js:2) at Function.ready (jquery-2.2.3.min.js:2) at HTMLDocument.J (jquery-2.2.3.min.js:2)

help me pls!

xOneca commented 7 years ago

You have to instantiate the editor with $("#txtEditor").Editor() first in order to be able to use setText.

xOneca commented 7 years ago

You have a good example in a comment on the thread #34 by @mouraleonardo (only I would replace addslashes with json_encode).

Meakrothany commented 7 years ago

okay i see thank! for your help!