开发者

What is all this strange code I find?

I've been asked to do a very simple task, write down some URLs of products so we can link them from our ezine to the website, simple right? Well yes, that's easy. But when I come to look at the link for one particular product, I see that the HTML page is messed up. Ok, so I figure I'll go in and fix it, can't be too difficult, it's in an WYSIWYG editor...

This website relies on PHP/smarty.

This is where it gets all kinds of messed up.

Here, in this fiddle is the code of the content, generated by the WYSIWYG editor (I didn't make this, some other monkey did).

As you can开发者_开发技巧 see, there's a large chunk of code that begins with:

<!--[if gte vml 1]><v:shapetype   

If I remove this, the entire thing decides not to display on the static HTML page, yet in any other product page this code isn't shown. Also, the layout is VERY messed up, no matter what I do (Even pasting the info in as plain text from notepad) won't fix any issues.

  1. What is this crazy code?
  2. Has anyone ever encountered such a situation with a WYSIWYG editor?
  3. If so, what can I do to make this page display my information coherently?

Thankyou very much SO.


EDIT

So I've stripped out all the unwanted HTML and made it super simple as shown here.

Yet when I add this into the HTML editor of the WYSIWYG thing and save, nothing displays in the corresponding page.

Anyone else had this kind of trouble?

Thanks.


These are CSS conditional comments.

In this case (if gte vml 1) the conditional appear to be for VML (Virtual Modeling Language) version one or above being installed.

This was probably pasted in, so you will need to edit to original HTML and clean it out.


That proprietary MS VML code. Someone probably copied and pasted from Word or another Office program.

Ive gotten in the habit of using something like HTMLPurifier on the server side in conjunction with locking down the editors to only allow a strict subset of tags to prevent this type of thing. If youre using FCK/CK there is also an option to make all paste operations use a plain text window before it puts it in the editor.


Things like that happen very often when users are pasting text from MS Word or other rich text editors.

You need to clean this code before publishing it or disallow direct pasting. TinyMCE WYSIWYG editor have some good options for that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜