Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 3ca7e0e5486da714e98ac79af09ca745 > files > 92

php-smarty2-doc-2.6.28-2.mga4.noarch.rpm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Math</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="Smarty Manual">
<link rel="up" href="language.basic.syntax.html" title="Chapter 3. Basic Syntax">
<link rel="prev" href="language.syntax.quotes.html" title="Embedding Vars in Double Quotes">
<link rel="next" href="language.escaping.html" title="Escaping Smarty Parsing">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Math</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="language.syntax.quotes.html">Prev</a> </td>
<th width="60%" align="center">Chapter 3. Basic Syntax</th>
<td width="20%" align="right"> <a accesskey="n" href="language.escaping.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="Math">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="language.math"></a>Math</h2></div></div></div>
<p>
  Math can be applied directly to variable values.
 </p>
<div class="example">
<a name="id3027820"></a><p class="title"><b>Example 3.7. math examples</b></p>
<div class="example-contents"><pre class="programlisting">

{$foo+1}

{$foo*$bar}

{* some more complicated examples *}

{$foo-&gt;bar-$bar[1]*$baz-&gt;foo-&gt;bar()-3*7}

{if ($foo+$bar.test%$baz*134232+10+$b+10)}

{$foo|truncate:"`$fooTruncCount/$barTruncFactor-1`"}

{assign var="foo" value="`$foo+$bar`"}

  </pre></div>
</div>
<br class="example-break"><p>
 See also the <a class="link" href="language.function.math.html" title="{math}">
 <code class="varname">{math}</code></a> function for complex equations
 and <a class="link" href="language.function.eval.html" title="{eval}"><code class="varname">{eval}</code></a>.
 </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="language.syntax.quotes.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="language.basic.syntax.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="language.escaping.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Embedding Vars in Double Quotes </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Escaping Smarty Parsing</td>
</tr>
</table>
</div>
</body>
</html>