code is not highlighting opened by file_get_contents

64 Views Asked by At

I made a codemirror editor but i've some problem

This is my code php code-

<?php
    $parameter = $_GET['codefilename'];
    $code = file_get_contents($parameter);
?>
<script>
    var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
        mode: 'htmlmixed',
        lineNumbers: true
    });
</script>

and

<textarea id="code">
    <html>
        <head>
            <title>title</title>
        </head>
        <body>
            codes.....
        </body>
    </html>
</textarea>

this code is highlighting, but opened by php code is not highlighting code is not highlighting-

<textarea id="code"><?=$code?></textarea>

In textarea $code are not highlighting. How to fix it

0

There are 0 best solutions below