Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Overview</h2> <p><a href="http://www.smarty.net/" rel="nofollow noreferrer">Smarty</a> templating engine for PHP lets easily separate application logic and presentation, the first being in PHP code and the other generally, but not always, in HTML. That way a separation of PHP and HTML code is encouraged.</p> <p>Currently two versions of Smarty are maintained <a href="/questions/tagged/smarty2" class="post-tag" title="show questions tagged &#39;smarty2&#39;" rel="tag">smarty2</a> for legacy purposes that is compatible with PHP 4 and PHP 5, and <a href="/questions/tagged/smarty3" class="post-tag" title="show questions tagged &#39;smarty3&#39;" rel="tag">smarty3</a> that is compatible with PHP 5.2 and newer.</p> <p>As of April 25th 2018, current Smarty releases are <strong>3.1.32</strong> and <strong>2.6.31</strong></p> <h2>Example</h2> <p>PHP script (<code>example.php</code>) :</p> <pre><code>require_once('../smarty/Smarty.class.php'); $se = new Smarty(); $se-&gt;assign('pi', 3.14159); $se-&gt;assign(array( 'title' =&gt; 'Hello World !', 'today' =&gt; date('d/m/Y'), )); $se-&gt;display('example.tpl'); </code></pre> <p>Template (<code>example.tpl</code>) :</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Smarty example&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;{$title}&lt;/p&gt; &lt;p&gt;Pi value : {$pi}&lt;/p&gt; &lt;p&gt;Today is : {$today}&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <h2>Links:</h2> <ul> <li><a href="http://www.smarty.net/" rel="nofollow noreferrer">Main Smarty site</a></li> <li><a href="http://www.smarty.net/docs/en/" rel="nofollow noreferrer">Online documentation</a></li> <li><a href="http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions" rel="nofollow noreferrer">Smarty FAQs</a></li> <li><a href="http://www.smarty.net/v3_overview" rel="nofollow noreferrer">Smarty 3 Overview</a></li> <li><a href="http://www.smarty.net/download" rel="nofollow noreferrer">Downloads</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload