title: PHP template engine which could separate presentation from back logic
body: <p>I am working for a java team now, but I am using PHP for private case.</p>
  
  <p>My work team are importing <a href="http://www.thymeleaf.org/" rel="nofollow">Thymeleaf</a> which is a powerful template engine for java.</p>
  
  <p>It can write variables for output or expressions such as <strong>if else</strong> into tags as <strong>attributes</strong>, e.g.:  </p>
  
  <pre><code>&lt;tr th:each="prod : ${allProducts}"&gt;  
    &lt;td th:text="${prod.name}"&gt;Oranges&lt;/td&gt;  
    &lt;td th:text="${#numbers.formatDecimal(prod.price,1,2)}"&gt;0.99&lt;/td&gt;  
  &lt;/tr&gt;  
  </code></pre>
  
  <p>It also can render in browser normally and without any java's variables or expression completely.</p>
  
  <p>When I use PHP, I know <strong>Smarty</strong> and <strong>twig</strong>.<br>
  But both of them have to write variables and expressions outside of tags(not as attributions), which displaying in browser.</p>
  
  <p>So I want to know whether there is some way to use Smarty or twig as Thymeleaf does.<br>
  Or other PHP template engines can do this easily.</p>
  
  <p>Best regards,</p>
  
  <p><strong>UPDATE</strong>  </p>
  
  <blockquote>
    <p>It also can render in browser normally and without any java's variables or expression completely.</p>
  </blockquote>
  
  <p>I mean this can be done without any parse process.<br>
  Just only open files in browser as if there is no any engine.</p>