1
0

index.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: PHP mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="../../addon/edit/matchbrackets.js"></script>
  9. <script src="../htmlmixed/htmlmixed.js"></script>
  10. <script src="../xml/xml.js"></script>
  11. <script src="../javascript/javascript.js"></script>
  12. <script src="../css/css.js"></script>
  13. <script src="../clike/clike.js"></script>
  14. <script src="php.js"></script>
  15. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  16. <link rel="stylesheet" href="../../doc/docs.css">
  17. </head>
  18. <body>
  19. <h1>CodeMirror: PHP mode</h1>
  20. <form><textarea id="code" name="code">
  21. <?php
  22. function hello($who) {
  23. return "Hello " . $who;
  24. }
  25. ?>
  26. <p>The program says <?= hello("World") ?>.</p>
  27. <script>
  28. alert("And here is some JS code"); // also colored
  29. </script>
  30. </textarea></form>
  31. <script>
  32. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  33. lineNumbers: true,
  34. matchBrackets: true,
  35. mode: "application/x-httpd-php",
  36. indentUnit: 4,
  37. indentWithTabs: true,
  38. enterMode: "keep",
  39. tabMode: "shift"
  40. });
  41. </script>
  42. <p>Simple HTML/PHP mode based on
  43. the <a href="../clike/">C-like</a> mode. Depends on XML,
  44. JavaScript, CSS, HTMLMixed, and C-like modes.</p>
  45. <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>
  46. </body>
  47. </html>