Answer the question
In order to leave comments, you need to log in
How to make friends TinyMCE and PHP code?
Hello.
I use TinyMCE and need to type PHP code in the editor (in source mode). The fact is that after switching to visual mode and back, the tags are escaped (something like <--? ?-->). Whether it is possible to bypass it somehow? Ideally, if in visual mode the code was replaced with some kind of icon. Tried the protect setting.
Here I found something similar, but the discussion is old and all the links are broken.
Answer the question
In order to leave comments, you need to log in
tinymce.init({
selector:'#editors',
language: 'ru',
theme: 'modern',
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor colorpicker textpattern imagetools codesample toc help'
],
toolbar1: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code ',
toolbar2: 'print preview media | forecolor backcolor emoticons | codesample help',
image_advtab: true,
protect: [
/<\?php.*?\?>/g, // Protect php code
/<\?.*?\?>/g, // Protect php code
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question