CodeMirror: Smarty mixed mode

{**
1
{**
2
* @brief Smarty mixed mode
3
* @author Ruslan Osmanov
4
* @date 29.06.2013
5
*}
6
<html>
7
<head>
8
  <title>{$title|htmlspecialchars|truncate:30}</title>
9
</head>
10
<body>
11
  {* Multiline smarty
12
  * comment, no {$variables} here
13
  *}
14
  {literal}
15
  {literal} is just an HTML text.
16
  <script type="text/javascript">//<![CDATA[
17
    var a = {$just_a_normal_js_object : "value"};
18
    var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("code"), {
19
      mode           : "smartymixed",
20
      tabSize        : 2,
21
      indentUnit     : 2,
22
      indentWithTabs : false,
23
      lineNumbers    : true,
24
      smartyVersion  : 3
25
    });
26
    // ]]>
27
  </script>
28
  <style>
29
    /* CSS content 
30
    {$no_smarty} */
31
    .some-class { font-weight: bolder; color: "orange"; }
32
  </style>
33
  {/literal}
34
 
35
  {extends file="parent.tpl"}
36
  {include file="template.tpl"}
37
 
38
  {* some example Smarty content *}
39
  {if isset($name) && $name == 'Blog'}
40
    This is a {$var}.
41
    {$integer = 4511}, {$array[] = "a"}, {$stringvar = "string"}
42
    {$integer = 4512} {$array[] = "a"} {$stringvar = "string"}
43
    {assign var='bob' value=$var.prop}
44
  {elseif $name == $foo}
45
    {function name=menu level=0}
46
    {foreach $data as $entry}
47
      {if is_array($entry)}
48
      - {$entry@key}
49
      {menu data=$entry level=$level+1}
50
      {else}
51
      {$entry}
52
      {* One
53
      * Two
54
      * Three
55
      *}
56
      {/if}
57
    {/foreach}
58
    {/function}
59
  {/if}
60
  </body>
61
  <!-- R.O. -->
62
</html>
63
 
 

The Smarty mixed mode depends on the Smarty and HTML mixed modes. HTML mixed mode itself depends on XML, JavaScript, and CSS modes.

It takes the same options, as Smarty and HTML mixed modes.

MIME types defined: text/x-smarty.