M
M
marsep2015-05-18 19:47:08
PHP
marsep, 2015-05-18 19:47:08

CodeMirror: Is it possible to set up syntax highlighting without using PHP tags?

Hello! Question for those who had experience with the CodeMirror (JavaScript) plugin. I need to make a PHP code editor with syntax highlighting, respectively, but there was such a problem in convenience. To make the highlighting work, you need to add a PHP tag before the code, as in this example:

<?php
echo "Hello, World!";

So the highlight will work as expected, but I would like to be able to write without tags, like this:
echo "Hello, World!";
Is it possible to configure this in CodeMirror or in some handler when receiving text, for example, add these tags automatically. Maybe someone faced similar? I turned all the official documentation, tried it in the search, but did not get any results. Thanks in advance for your support!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
syler222, 2015-05-19
@syler222

As a solution, insert the default opening tag:
<?php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question