manic Posted February 22, 2015 Share Posted February 22, 2015 Hi again! Have downloaded and installed CKEditor. It shows on my add page form ok. I can add text and add the page ok, and the content is safely stored in the database. However, when the add_page redisplays with the confirmation message, the content appears in the textarea field (CKeditor panel) as plain text together with formatting tags. ie it is not behaving as a WYSIWYG editor. How do I get this to display as WYSIWYG content? PS the allowed formatting tags are correctly stored on the database and the actual page displays properly when I visit it, so this is about getting the $_POST['content'] to display properly in the CKeditor field on the form. Any clues? Have I failed to install/configure the editor properly, or do I need to manipulate the $_POST['content'] in some way? Link to comment Share on other sites More sharing options...
Larry Posted February 23, 2015 Share Posted February 23, 2015 I can't remember offhand: is the content being displayed within the editor coming from the database or from $_POST? I'd also check the HTML source code to see if entities are being used (e.g., <), which would explain why CKeditor is showing the code item itself ( Link to comment Share on other sites More sharing options...
manic Posted February 24, 2015 Author Share Posted February 24, 2015 Thank you for your response. The idea was to adapt the original add_page.php form into an edit form, so that a first draft of a page which was originally entered via the add_page form and stored on the database could be amended/updated. In order to get the stored data to display on the edit form, I was setting it to $_POST['content'], so that when the form loaded, the create_form_input() function would display the content in the editor. You are right, (of course!), entities are being used. I substituted your mysqli_real_escape_string for htmlspecialchars (mainly because I am not familiar with mysqli. For example, I am using $pdo to connect to the database. After some investigation, I am using html_entity_decode() to return the entities to the corresponding symbols, and the CKEditor is now correctly formatting these and so is a WYSIWYG text editor once again. Thank you for pointing me in the right direction on this! Link to comment Share on other sites More sharing options...
Larry Posted February 25, 2015 Share Posted February 25, 2015 Awesome! Thanks for letting me know! Link to comment Share on other sites More sharing options...
Recommended Posts