1
0

index.html 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Smarty mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="smarty.js"></script>
  9. <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  10. <link rel="stylesheet" href="../../doc/docs.css">
  11. </head>
  12. <body>
  13. <h1>CodeMirror: Smarty mode</h1>
  14. <form><textarea id="code" name="code">
  15. {extends file="parent.tpl"}
  16. {include file="template.tpl"}
  17. {* some example Smarty content *}
  18. {if isset($name) && $name == 'Blog'}
  19. This is a {$var}.
  20. {$integer = 451}, {$array[] = "a"}, {$stringvar = "string"}
  21. {assign var='bob' value=$var.prop}
  22. {elseif $name == $foo}
  23. {function name=menu level=0}
  24. {foreach $data as $entry}
  25. {if is_array($entry)}
  26. - {$entry@key}
  27. {menu data=$entry level=$level+1}
  28. {else}
  29. {$entry}
  30. {/if}
  31. {/foreach}
  32. {/function}
  33. {/if}</textarea></form>
  34. <script>
  35. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  36. lineNumbers: true,
  37. mode: "smarty"
  38. });
  39. </script>
  40. <br />
  41. <form><textarea id="code2" name="code2">
  42. {--extends file="parent.tpl"--}
  43. {--include file="template.tpl"--}
  44. {--* some example Smarty content *--}
  45. {--if isset($name) && $name == 'Blog'--}
  46. This is a {--$var--}.
  47. {--$integer = 451--}, {--$array[] = "a"--}, {--$stringvar = "string"--}
  48. {--assign var='bob' value=$var.prop--}
  49. {--elseif $name == $foo--}
  50. {--function name=menu level=0--}
  51. {--foreach $data as $entry--}
  52. {--if is_array($entry)--}
  53. - {--$entry@key--}
  54. {--menu data=$entry level=$level+1--}
  55. {--else--}
  56. {--$entry--}
  57. {--/if--}
  58. {--/foreach--}
  59. {--/function--}
  60. {--/if--}</textarea></form>
  61. <script>
  62. var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {
  63. lineNumbers: true,
  64. mode: {
  65. name: "smarty",
  66. leftDelimiter: "{--",
  67. rightDelimiter: "--}"
  68. }
  69. });
  70. </script>
  71. <p>A plain text/Smarty mode which allows for custom delimiter tags (defaults to <b>{</b> and <b>}</b>).</p>
  72. <p><strong>MIME types defined:</strong> <code>text/x-smarty</code></p>
  73. </body>
  74. </html>