0

I can't seem to find a js RTE that will play friendly with snippets of php intertwined in it. I want a mini CMS for the backend of a number of sites. The views have some snippets of php here and there

Are there any RTE's that will leave the php alone, and even show it mixed with the nice formatting?

TinyMCE kills the tags even when entered in html mode and switched back and forth. FCKEdit seems to keep the code intact if pasted into source mode, but it isn't shown in the editing side, so if someone deletes an element with some php in it, bop, it's gone.

And none of the editors like creating nicely indented code, that would be a nice plus as well, but probably over the top to ask, heh.

2 Answers 2

1

The Javascript rich text editors make use of the browsers' in-built DesignMode or ContentEditable features in order to implement in-line HTML editing, and these do not support embedded PHP tags.

The solution would have to convert these to some other form, which is not going to get mushed by the browser's HTML editor, then convert them back to PHP tags upon submission.

It could be done. I don't know of any that do, however.

As for creating nicely indented code, it is a similar issue. The browsers munge it in their in-line HTML editors.

Sign up to request clarification or add additional context in comments.

2 Comments

I thought that might be the case. I tried adding a <pre> before and after the tags: <pre><?php ?></pre> And was hoping I could mod the code to do a quick regex replace of "<pre><?php" to "<?php" upon saving, but it seems the RTE's don't play nice with <pre> either...
I think you are on the right track with <pre>. Did you try also escaping its contents as in <pre><?php ?></pre>? I have a feeling that should be preserved by the browsers. I can't promise it though.
0

I had a similar question a few weeks back: Textarea that can do syntax highlighting on the fly?

This may be the right thing for you: http://marijn.haverbeke.nl/codemirror/ They even have mixed PHP and HTML highlighting.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.