Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/smarty
File: index.html
<!doctype html>
[0] Fix | Delete
[1] Fix | Delete
<title>CodeMirror: Smarty mode</title>
[2] Fix | Delete
<meta charset="utf-8"/>
[3] Fix | Delete
<link rel=stylesheet href="../../doc/docs.css">
[4] Fix | Delete
[5] Fix | Delete
<link rel="stylesheet" href="../../lib/codemirror.css">
[6] Fix | Delete
<script src="../../lib/codemirror.js"></script>
[7] Fix | Delete
<script src="../xml/xml.js"></script>
[8] Fix | Delete
<script src="smarty.js"></script>
[9] Fix | Delete
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
[10] Fix | Delete
<div id=nav>
[11] Fix | Delete
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
[12] Fix | Delete
[13] Fix | Delete
<ul>
[14] Fix | Delete
<li><a href="../../index.html">Home</a>
[15] Fix | Delete
<li><a href="../../doc/manual.html">Manual</a>
[16] Fix | Delete
<li><a href="https://github.com/codemirror/codemirror">Code</a>
[17] Fix | Delete
</ul>
[18] Fix | Delete
<ul>
[19] Fix | Delete
<li><a href="../index.html">Language modes</a>
[20] Fix | Delete
<li><a class=active href="#">Smarty</a>
[21] Fix | Delete
</ul>
[22] Fix | Delete
</div>
[23] Fix | Delete
[24] Fix | Delete
<article>
[25] Fix | Delete
<h2>Smarty mode</h2>
[26] Fix | Delete
<form><textarea id="code" name="code">
[27] Fix | Delete
{extends file="parent.tpl"}
[28] Fix | Delete
{include file="template.tpl"}
[29] Fix | Delete
[30] Fix | Delete
{* some example Smarty content *}
[31] Fix | Delete
{if isset($name) && $name == 'Blog'}
[32] Fix | Delete
This is a {$var}.
[33] Fix | Delete
{$integer = 451}, {$array[] = "a"}, {$stringvar = "string"}
[34] Fix | Delete
{assign var='bob' value=$var.prop}
[35] Fix | Delete
{elseif $name == $foo}
[36] Fix | Delete
{function name=menu level=0}
[37] Fix | Delete
{foreach $data as $entry}
[38] Fix | Delete
{if is_array($entry)}
[39] Fix | Delete
- {$entry@key}
[40] Fix | Delete
{menu data=$entry level=$level+1}
[41] Fix | Delete
{else}
[42] Fix | Delete
{$entry}
[43] Fix | Delete
{/if}
[44] Fix | Delete
{/foreach}
[45] Fix | Delete
{/function}
[46] Fix | Delete
{/if}</textarea></form>
[47] Fix | Delete
[48] Fix | Delete
<p>Mode for Smarty version 2 or 3, which allows for custom delimiter tags.</p>
[49] Fix | Delete
[50] Fix | Delete
<p>Several configuration parameters are supported:</p>
[51] Fix | Delete
[52] Fix | Delete
<ul>
[53] Fix | Delete
<li><code>leftDelimiter</code> and <code>rightDelimiter</code>,
[54] Fix | Delete
which should be strings that determine where the Smarty syntax
[55] Fix | Delete
starts and ends.</li>
[56] Fix | Delete
<li><code>version</code>, which should be 2 or 3.</li>
[57] Fix | Delete
<li><code>baseMode</code>, which can be a mode spec
[58] Fix | Delete
like <code>"text/html"</code> to set a different background mode.</li>
[59] Fix | Delete
</ul>
[60] Fix | Delete
[61] Fix | Delete
<p><strong>MIME types defined:</strong> <code>text/x-smarty</code></p>
[62] Fix | Delete
[63] Fix | Delete
<h3>Smarty 2, custom delimiters</h3>
[64] Fix | Delete
[65] Fix | Delete
<form><textarea id="code2" name="code2">
[66] Fix | Delete
{--extends file="parent.tpl"--}
[67] Fix | Delete
{--include file="template.tpl"--}
[68] Fix | Delete
[69] Fix | Delete
{--* some example Smarty content *--}
[70] Fix | Delete
{--if isset($name) && $name == 'Blog'--}
[71] Fix | Delete
This is a {--$var--}.
[72] Fix | Delete
{--$integer = 451--}, {--$array[] = "a"--}, {--$stringvar = "string"--}
[73] Fix | Delete
{--assign var='bob' value=$var.prop--}
[74] Fix | Delete
{--elseif $name == $foo--}
[75] Fix | Delete
{--function name=menu level=0--}
[76] Fix | Delete
{--foreach $data as $entry--}
[77] Fix | Delete
{--if is_array($entry)--}
[78] Fix | Delete
- {--$entry@key--}
[79] Fix | Delete
{--menu data=$entry level=$level+1--}
[80] Fix | Delete
{--else--}
[81] Fix | Delete
{--$entry--}
[82] Fix | Delete
{--/if--}
[83] Fix | Delete
{--/foreach--}
[84] Fix | Delete
{--/function--}
[85] Fix | Delete
{--/if--}</textarea></form>
[86] Fix | Delete
[87] Fix | Delete
<h3>Smarty 3</h3>
[88] Fix | Delete
[89] Fix | Delete
<textarea id="code3" name="code3">
[90] Fix | Delete
Nested tags {$foo={counter one=1 two={inception}}+3} are now valid in Smarty 3.
[91] Fix | Delete
[92] Fix | Delete
<script>
[93] Fix | Delete
function test() {
[94] Fix | Delete
console.log("Smarty 3 permits single curly braces followed by whitespace to NOT slip into Smarty mode.");
[95] Fix | Delete
}
[96] Fix | Delete
</script>
[97] Fix | Delete
[98] Fix | Delete
{assign var=foo value=[1,2,3]}
[99] Fix | Delete
{assign var=foo value=['y'=>'yellow','b'=>'blue']}
[100] Fix | Delete
{assign var=foo value=[1,[9,8],3]}
[101] Fix | Delete
[102] Fix | Delete
{$foo=$bar+2} {* a comment *}
[103] Fix | Delete
{$foo.bar=1} {* another comment *}
[104] Fix | Delete
{$foo = myfunct(($x+$y)*3)}
[105] Fix | Delete
{$foo = strlen($bar)}
[106] Fix | Delete
{$foo.bar.baz=1}, {$foo[]=1}
[107] Fix | Delete
[108] Fix | Delete
Smarty "dot" syntax (note: embedded {} are used to address ambiguities):
[109] Fix | Delete
[110] Fix | Delete
{$foo.a.b.c} => $foo['a']['b']['c']
[111] Fix | Delete
{$foo.a.$b.c} => $foo['a'][$b]['c']
[112] Fix | Delete
{$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c']
[113] Fix | Delete
{$foo.a.{$b.c}} => $foo['a'][$b['c']]
[114] Fix | Delete
[115] Fix | Delete
{$object->method1($x)->method2($y)}</textarea>
[116] Fix | Delete
[117] Fix | Delete
<script>
[118] Fix | Delete
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
[119] Fix | Delete
lineNumbers: true,
[120] Fix | Delete
mode: "smarty"
[121] Fix | Delete
});
[122] Fix | Delete
var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {
[123] Fix | Delete
lineNumbers: true,
[124] Fix | Delete
mode: {
[125] Fix | Delete
name: "smarty",
[126] Fix | Delete
leftDelimiter: "{--",
[127] Fix | Delete
rightDelimiter: "--}"
[128] Fix | Delete
}
[129] Fix | Delete
});
[130] Fix | Delete
var editor = CodeMirror.fromTextArea(document.getElementById("code3"), {
[131] Fix | Delete
lineNumbers: true,
[132] Fix | Delete
mode: {name: "smarty", version: 3, baseMode: "text/html"}
[133] Fix | Delete
});
[134] Fix | Delete
</script>
[135] Fix | Delete
[136] Fix | Delete
</article>
[137] Fix | Delete
[138] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function