Wednesday, January 16, 2013

HTML in forms

I have integrated CKEditor with a file browser / uploads and all that is working fine except the actual image part.

 

If I used the editor to create a table, ul ol lists the html saves in the database fine.

But whenever I insert an image the code gets encoded.

 

Example1: Random elements / table /lists saved to database, rendered view shows fine

<ol><li>d</li><li>d</li><li>d</li><li>d</li></ol><ul><li>d</li><li>d</li><li>d</li><li>d</li></ul><table border="1" cellpadding="1" cellspacing="1" ><tbody><tr><td>2</td></tr><tr><td><br /></td></tr><tr><td>6</td></tr></tbody></table>

 

Example 2 Adding image

<p>hello</p><p>&lt;img alt=&quot;&quot; src=&quot; img/uploads/images/30a5y0otukrujkl4xny43j04o269669817.2.jpg&quot; style=&quot;width: 405px; height: 540px;&quot; /&gt;</p>

 

So the image never gets displayed.

View:

<?php echo $about['About']['content']; ?>

 

There is nothing for beforeSave() or edits to any of the data submitted.

 

I cannot firure out why it only escapes the Img tag but all other HTML is fine.

 

Any ideas how to escape => false for input? Or suggestions to fix this?

 

Thanks,

Dave

No comments: