Welcome Guest, Not a member yet? Register   Sign In
How to show Original HTML post after sanitizing?
#1

[eluser]Unknown[/eluser]
I am writing a Blog module, and sanitize the blog_post at INPUT with

Code:
$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 .:/
#2

[eluser]NeoArc[/eluser]
Try $_POST['blog_data'] or $this->input->post('blog_data');

The satinized value is returned by $this->form_validation->set_value('blog_data'), only if you define a rule, of course.
#3

[eluser]InsiteFX[/eluser]
htmlentities
#4

[eluser]NeoArc[/eluser]
Yeah, htmlentities, if you have only the satinized data available Smile




Theme © iAndrew 2016 - Forum software by © MyBB