Home > Backend Development > PHP Tutorial > 有没有语法上比较像angularJS的php模板引擎

有没有语法上比较像angularJS的php模板引擎

WBOY
Release: 2016-06-06 20:10:34
Original
1077 people have browsed it

初学php 看了下目前最流行的smarty语法是这样的:

<code><ul>
{%foreach $list as $item%}
<li class="{%if($item=>isBoy)%}boy{%/if%}">{%$item=>name%}</li>
{%/foreach%}
</ul>
</code>
Copy after login
Copy after login

之前用angularJS开发移动应用 很喜欢angular的模板语法:

<code><ul>
<li ng-repeat="item in list" ng-class="{boy:item.isBoy}">{{item.name}}</li>
</ul>
</code>
Copy after login
Copy after login

不知道有没有类似这样的模板引擎:

<code><ul>
<li php-repeat="$list as $item" php-class="array('boy'=>$item=>isBoy)">{%$item=>name%}</li>
</ul>
</code>
Copy after login
Copy after login

回复内容:

初学php 看了下目前最流行的smarty语法是这样的:

<code><ul>
{%foreach $list as $item%}
<li class="{%if($item=>isBoy)%}boy{%/if%}">{%$item=>name%}</li>
{%/foreach%}
</ul>
</code>
Copy after login
Copy after login

之前用angularJS开发移动应用 很喜欢angular的模板语法:

<code><ul>
<li ng-repeat="item in list" ng-class="{boy:item.isBoy}">{{item.name}}</li>
</ul>
</code>
Copy after login
Copy after login

不知道有没有类似这样的模板引擎:

<code><ul>
<li php-repeat="$list as $item" php-class="array('boy'=>$item=>isBoy)">{%$item=>name%}</li>
</ul>
</code>
Copy after login
Copy after login

https://github.com/esvit/php-angular

随意搜了一下找到这个,应该有人做过了。我个人觉得还是挺好的,而且PHP也完全可以实现。

smarty的标签对是可以做修改的!

没想到居然有和我想法一样的, 之前我也找过类似angularjs的php模板引擎, 没找到, 后来就自己写了个:http://www.kancloud.cn/shuai/php-angular/127397

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template