
Originally Posted by
Nick1973
Why the sarcasm? I seem to get this everytime in some form, from you for some reason Dr Byte.
Sorry. It's really nothing personal. I've been battling a really challenging project today, and taking personal attacks from a crew of jerks. I'm terribly sorry it's spilled off on you. I'm "escaping" the madness by answering forum posts.
Thanks for voicing it. I'm not proud of treating you like that.

Originally Posted by
Nick1973
And really you haven't answered the original question anyway anyway as you have just told me to do what I have tried already.
We've gone around in circles because I assumed you wanted to clean the database, cuz that's the most common kind of request I see. But, now that I think we're seeing it the same way, I have some ideas:
I haven't set up a site to test your exact situation. But this is how I'd tackle it (although I'd prefer to clean the database instead):
I'm gonna assume that the javascript you quoted for doing the cleaning is trustworthy and properly functional to do the task required.
a) get the javascript for the cleanup function into the page. This can be done several ways. Two common ways are to either paste it into the HTML of the template file, such as tpl_product_info_display.php (above where the description is output), or to put it in a jscript_xxxxx file as described in the article I linked to (so that it loads in the <head> of the page).
b) then, somewhere on the page, at a point after the cleanup function is loaded into the page's HTML, add some javascript to "fire" the cleanup. I'd probably put that in the tpl_product_info_display.php after the output of the product description field.
Perhaps this sort of code might work:
Code:
<script type="text/javascript">
// get all elements using this class name
var x = document.getElementsByClassName("mainDescription");
var i;
// loop thru all the found elements, and replace them with the cleaned version
for (i = 0; i < x.length; i++) {
x[i].innerHTML = cleanHTML(x[i].innerHTML);
}
</script>