Reputation: 13
I create templates, mostly for webshops.
My template:
<div class="product_desc">
[variableForDescription]
</div>
If my clients add products, especially the product description, sometimes they paste incorrect html code. For example a closing div-tag:
<div class="product_desc">
<p>nice product</p></div>
</div>
sometimes the result is that the whole template is broken. I´m not able to check the description with php. Is there any way to ignore such wrong code so that the wrong code in the "product_desc"-div does not affect the rest of the template?
Upvotes: 1
Views: 49
Reputation: 943650
HTML provides no mechanism to do that.
If you provide software to insert the submitted data into the template then you could build a check into that software (preferably one that involves a real HTML parser).
This is the same technique used to defend against XSS while allowing HTML.
Upvotes: 1