| 1 |
<!doctype html> |
| 2 |
|
| 3 |
<title>CodeMirror: PHP mode</title> |
| 4 |
<meta charset="utf-8"/> |
| 5 |
<link rel=stylesheet href="../../doc/docs.css"> |
| 6 |
|
| 7 |
<link rel="stylesheet" href="../../lib/codemirror.css"> |
| 8 |
<script src="../../lib/codemirror.js"></script> |
| 9 |
<script src="../../addon/edit/matchbrackets.js"></script> |
| 10 |
<script src="../htmlmixed/htmlmixed.js"></script> |
| 11 |
<script src="../xml/xml.js"></script> |
| 12 |
<script src="../javascript/javascript.js"></script> |
| 13 |
<script src="../css/css.js"></script> |
| 14 |
<script src="../clike/clike.js"></script> |
| 15 |
<script src="php.js"></script> |
| 16 |
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> |
| 17 |
<div id=nav> |
| 18 |
<a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a> |
| 19 |
|
| 20 |
<ul> |
| 21 |
<li><a href="../../index.html">Home</a> |
| 22 |
<li><a href="../../doc/manual.html">Manual</a> |
| 23 |
<li><a href="https://github.com/marijnh/codemirror">Code</a> |
| 24 |
</ul> |
| 25 |
<ul> |
| 26 |
<li><a href="../index.html">Language modes</a> |
| 27 |
<li><a class=active href="#">PHP</a> |
| 28 |
</ul> |
| 29 |
</div> |
| 30 |
|
| 31 |
<article> |
| 32 |
<h2>PHP mode</h2> |
| 33 |
<form><textarea id="code" name="code"> |
| 34 |
<?php |
| 35 |
function hello($who) { |
| 36 |
return "Hello " . $who; |
| 37 |
} |
| 38 |
?> |
| 39 |
<p>The program says <?= hello("World") ?>.</p> |
| 40 |
<script> |
| 41 |
alert("And here is some JS code"); // also colored |
| 42 |
</script> |
| 43 |
</textarea></form> |
| 44 |
|
| 45 |
<script> |
| 46 |
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 47 |
lineNumbers: true, |
| 48 |
matchBrackets: true, |
| 49 |
mode: "application/x-httpd-php", |
| 50 |
indentUnit: 4, |
| 51 |
indentWithTabs: true, |
| 52 |
enterMode: "keep", |
| 53 |
tabMode: "shift" |
| 54 |
}); |
| 55 |
</script> |
| 56 |
|
| 57 |
<p>Simple HTML/PHP mode based on |
| 58 |
the <a href="../clike/">C-like</a> mode. Depends on XML, |
| 59 |
JavaScript, CSS, HTMLMixed, and C-like modes.</p> |
| 60 |
|
| 61 |
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p> |
| 62 |
</article> |
| 63 |
|