TinyMCE escapes some especial characters - tinymce

When, for example, I write this HTML with tinyMCE:
<p>asdasd</p>
<p class="relevant">asd</p>
<p>as</p>
the php that receives the form post prints the next:
<p>asdasd</p>
<p class=\"relevant\">asd</p>
<p>as</p>
How can turn off this behavior?
Thank you in advance

This is most likely due to the MagicQuotes feature in PHP and is covered in the TinyMCE FAQ.
The simplest way to deal with this is to disable the feature, especially as it has been deprecated as of PHP 5.3.0
An alternative is to clean up the results using
stripslashes($_POST['text']);

Related

Handlebars formatting in NetBeans

I'm using NetBeans as my IDE for a Ember.js project. When I create handlebars templates in my app like below the code highlighting doesn't work correctly.
<script type="text/x-handlebars">
<div>
</div>
</script>
Normally, when I'd select the first div, it and its matching end tag would highlight yellow, but this doesn't work. Since its inside the handlebars script tag both are highlighted red as errors and don't match together. This makes writing complex templates kinda annoying as it can be difficult to pinpoint syntax errors.
Is there anyway to get NetBeans to highlight inside the handlebars tag as if its regular html?
One option, until Netbeans implements this enhancement, is to add the following script tag in index.html immediately after your reference to jQuery:
<script src="js/libs/jquery.js"></script>
<!-- use following line to change script type to 'text/x-handlebars' -->
<script>jQuery('script[type="text/html"]').attr('type', 'text/x-handlebars');</script>
This is a variation of the answer provided by GCoda.
I had the same problem and tried various non satisfying fixes.
In the end I figured the best solution is simply to change the script's type attribute to text/html:
<script type="text/html">
<div>
</div>
</script>
I got same problem. And i just used a some kind of postprocessing, i am using node.js, so i did res.send(data.replace(/type="text\/html"/g,'type="text/x-handlebars"')); on my / page.
I think you can do something similar in you language, and ofcource this is not a fix, just an ugly trick to make developing more easy. Dont keep it in production.

HTML comment tag <!-- --> Removed in CQ5

I'm using Rich Text Editor with MiscTools plugin to edit text in CQ%
However when I open the HTML editor and create sth like this
<div id="test">Test <!-- Test Comment --></div>
the CQ rewrites it to after switch back to HTML mode and source edit mode
<div id="test">Test </div>
Is it possible to keep HTML comment tag <!-- --> in the source code?
Thank you for answer my question
I would suggest taking it out of the div and see if that works.
In CQ5.4-5.6.1 (not sure about latest version AEM6), the Rich Text Editor intentionally strips out all HTML comments. The only way to stop it from doing this is to modify the product javascript source code in WhitespaceProcessor.js. However, allowing HTML comments in this way wouldn't be recommended as it hasn't been fully tested it might cause other errors. If you still need this feature, then you might consider contacting Adobe Customer Care to request it to be officially added to the product.

Question marks where should be an X

I'm using Zend Framework and Twitter Bootstrap for a website. From twitter bootstrap I'm using things like the alert:
<div class="alert">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Warning!</strong> Best check yo self, you're not looking too good.
</div>
Where an X is supposed to appear, appears a question mark (?). I have my charset as UTF-8.
That is not the only thing that is happening but in many places where I'm supposed to have Spanish characters what appears is a question mark. Does anybody know what's wrong? Thanks!
Dito, you might just put an simple x there instead of the multiply sign. You can also check out if it works with this HTML entity:
×
I've learned that encoding is a very difficult topic. There is the doctype declaration in your document – but there is also the web server (apache?) declaration and even a PHP setting. You can check out your website settings by hitting cmd+I (ctrl+i on a pc/linux) in FireFox.
My Hex editor told me that it is × and not x .
Remove charset from your meta in html and try again. Also, try to replace that with a 'real' x.

Jump to CSS definition when editing HTML in VIM

For example I am editing index.html or index.php in VIM and I have the following code in there:
<div id="header">
// some code
</div>
When I move my cursor to the word header I want to jump to the position in my CSS-file where the tag (id/class) is defined. ctags doesnt work with this. Thx for advise!
You could try to patch ctags so that it supports CSS. This guy explains how but I have no idea if it works or not. I'll probably give this solution a try very soon as I think this feature would kick ass.
Also, I should add that I didn't pull this old blog post from my magic bookmarks hat. It was one of the first results of a very simple Google query, did you look around before asking here? And, if you did, what did you found/try?
See also there and there.
edit
This solution doesn't require patching/compiling and works very well.

TinyMCE writes terrible HTML!

I've currently got TinyMCE incorporated into the backend editor of a simple blogging/page-editing app, but I'm extremely unhappy with the HTML code it creates. It does all sorts of messy things like:
Adding inline style information to span tags that you can't ever find to get rid of without editing the HTML directly.
Nesting tags in nonsense ways (e.g. <p><strong><p><span>some text</span></p><strong></p> just to make something bold.)
Adding empty <p> </p> lines where they don't belong and I'm not trying to create blank lines.
EDIT: I've looked at lists of the other editors out there (including on SO), but I want to know if people firsthand have had better luck getting clean code out of their wysiwyg editors.
Any recommendations for one that outputs better code behind the scenes?
How about a rather drastic alternative, and using a WYMIWYG (What You Mean is What You Get) editor rather that another WYSIWYG editor. That way the author is in full control of the schematic markup as well as the content he/she is entering.
Unfortunately I haven't found one that is as feature rich and usable as tinyMCE, but it seems to have come a long way - see http://www.wymeditor.org/demo/
Use HTML purifier before saving the content into the database.
HTML Purifier
I found JoomlaFCK to be a very good alternative to Tiny MCE.
Hope you like it.
bye
BTW I know it is an old thread but someone might use it. ;)