CodeIgniter Forums
WYSIWYG Editor Not Interpreting Correctly CodeIgniter 3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: WYSIWYG Editor Not Interpreting Correctly CodeIgniter 3 (/showthread.php?tid=72213)



WYSIWYG Editor Not Interpreting Correctly CodeIgniter 3 - TemiU - 11-21-2018

We are in the process of upgrading our website from CodeIgniter 2 to CodeIgniter 3.  (3.1.9)

We have a WYSIWYG editor for editing website pages on the back-end of the site, which pulls html code from a database table and should display it in the editor.  

When the html code from the database displays in what should be WYSIWYG format, it is currently displaying with the html tags so that it looks something like this:
<p><b>Coming Soon!</p></b>
Instead of Coming Soon!

When the display is changed to show the html (via use of a toggle button), it will display as:
&lt;p&gt;&lt;b&gt;Coming Soon!   [etc.]
Instead of <p><b>Coming Soon!</p></b>

Since it is working correctly in CodeIgniter 2, it seems to be an issue with how CodeIgniter is interpreting the information coming from the database.

The code for retrieving and displaying the data is:
PHP Code:
$data    = array('name'=>'content''class'=>'redactor''value'=>set_value('content'htmlentities($content)), 'data-bv-excluded'=>'false');
echo 
form_textarea($data); 

What would we need to change in order to get the code to display correctly?


RE: WYSIWYG Editor Not Interpreting Correctly CodeIgniter 3 - jreklund - 11-21-2018

You need to turn off html_escape.
PHP Code:
set_value('content'$contentFALSE



RE: WYSIWYG Editor Not Interpreting Correctly CodeIgniter 3 - TemiU - 11-25-2018

Thank you - that worked for showing the WYSIWYG text.

However, the style keeps getting erased for images, so that they are not being aligned properly.

For example, in the html of the editor, instead of:
Code:
<img style="float: left; margin: 0px 20px 10px 0px; max-width: 95%; border: 6px double rgb(84, 85, 101); width: 401px; height: 601px;" src="//www.mywebsite.com/uploads/wysiwyg/About-Us.jpg" alt="My Website" height="300">

The following is showing:
Code:
<img xss="removed" src="//www.mywebsite.com/uploads/wysiwyg/About-Us.jpg" alt="My Website" height="300" style="">