Hash :
c3ed5b52
Author :
Date :
2018-03-11T11:11:05
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
<h2>Comments</h2>
<pre><code>{* This is a comment with <p>some markup</p> in it *}
{* Multi-line
comment *}</code></pre>
<h2>Variables</h2>
<pre><code>{$foo}
{$foo.bar}
{$foo.$bar}
{$foo[$bar]}
{$foo->bar}
{$foo->bar()}
{#foo#}
{$smarty.config.foo}
{$foo[bar]}
</code></pre>
<h2>Strings and numbers</h2>
<pre><code>{$foo[4]}
{$foo['bar']}</code></pre>
<h2>Tags and filters</h2>
<pre><code>{assign var=foo value='baa'}
{include file='header.tpl'}
{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}
{$title|truncate:40:'...'}
{$myArray|@count}
{math equation="height * width / division"
height=$row_height
width=$row_width
division=#col_div#}</code></pre>
<h2>Control flow</h2>
<pre><code>{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
...
{/if}
{if count($var) gt 0}{/if}
{if $var is even by 3}
...
{/if}
{foreach from=$myArray item=i name=foo}
{$smarty.foreach.foo.index}|{$smarty.foreach.foo.iteration},
{/foreach}
<ul>
{foreach from=$items key=myId item=i}
<li><a href="item.php?id={$myId}">{$i.no}: {$i.label}</li>
{/foreach}
</ul>
</code></pre>
<h2>Literal section</h2>
<pre><code>{literal}
<script>
(function() { /* This is JS, not Smarty */ } ());
</script>
{/literal}
<style type="text/css">
{literal}
/* this is an intersting idea for this section */
.madIdea{
border: 3px outset #ffffff;
margin: 2 3 4 5px;
background-color: #001122;
}
{/literal}
</style></code></pre>
<h2>Known failures</h2>
<p>There are certain edge cases where Prism will fail.
There are always such cases in every regex-based syntax highlighter.
However, Prism dares to be open and honest about them.
If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
</p>
<h3>Smarty tag in the middle of an HTML tag</h3>
<pre><code><div{if $test} class="test"{/if}></div></code></pre>