Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP template engine which could separate presentation from back logic

I am working for a java team now, but I am using PHP for private case.

My work team are importing Thymeleaf which is a powerful template engine for java.

It can write variables for output or expressions such as if else into tags as attributes, e.g.:

<tr th:each="prod : ${allProducts}">  
  <td th:text="${prod.name}">Oranges</td>  
  <td th:text="${#numbers.formatDecimal(prod.price,1,2)}">0.99</td>  
</tr>  

It also can render in browser normally and without any java's variables or expression completely.

When I use PHP, I know Smarty and twig.
But both of them have to write variables and expressions outside of tags(not as attributions), which displaying in browser.

So I want to know whether there is some way to use Smarty or twig as Thymeleaf does.
Or other PHP template engines can do this easily.

Best regards,

UPDATE

It also can render in browser normally and without any java's variables or expression completely.

I mean this can be done without any parse process.
Just only open files in browser as if there is no any engine.

like image 448
tech_me Avatar asked Nov 28 '25 14:11

tech_me


1 Answers

I have got it!

It's PHPTAL.
Exactly as Thymleaf does!

So wonderful!

like image 64
tech_me Avatar answered Nov 30 '25 05:11

tech_me



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!