I am writing a Blog module, and sanitize the blog_post at INPUT with
$this->form_validation->set_rules('blog_data', 'Blog Post', 'trim|required|min_length[5]|xss_clean');
Now that the input has been sanitized I have lost the HTML styling, Can anyone recommend a way to get the styling back to show the blog post in the original styling as posted by the user?
If sanitizing the HTML data at OUTPUT (instead of INPUT) is a good practice then how do people retain the original styling?
For example, wordpress is storing HTML data of user blogs in original form with all styling tags intact (raw HTML). But it must be sanitizing it during output. Then how does it retain the original styling?
How to do it in codeigniter? Please help I have been banging my head for 3 days now .:/
Followup- @Damien Pirsy –
Original code obtained from sql-db:
<img src="http://localhost/lok/images/63a9f0ea7bb98050796b649e85481845/11342974127.jpg" style="cursor: default; height: 208px; float: left; margin: 0px 10px 10px 0px; ">
Output Obtained on web-browser:
<img src="http://localhost/lok/images/63a9f0ea7bb98050796b649e85481845/11342974127.jpg" default; height: 208px; float: left; margin: 0px 10px 10px 0px; ">
Using “htmlpurifier” with CodeIgniter. The img src styling is unaffected now.