[英]How to use { in place of opening tags and } in place of closing tags?
I am an MVC
addict. 我是
MVC
上瘾者。
I have some views
in plain PHP (not using any Templating Engine
(TE) such as Smarty
for getting good performance), but without Smarty
my views
are looking ugly and hard to code. 我在普通的PHP中有一些
views
(没有使用Smarty
类的任何Templating Engine
(TE)来获得良好的性能),但是没有Smarty
我的views
看起来很难看并且很难编写代码。
I'm wondering how can I make them look good (ie., human readable) without using any TE
? 我想知道如何在不使用任何
TE
情况下使它们看起来不错(即人类可读)? At least I want to replace those <?php
and ?>
for sure, or if you have any other better idea? 至少我肯定要替换那些
<?php
和?>
,或者是否还有其他更好的主意?
It's just a start of my web application so please guide me to any better alternative if you have any. 这只是我的Web应用程序的开始,因此,如果有任何其他选择,请引导我。
Thanks. 谢谢。
In templates I use the alternatives of PHP like: 在模板中,我使用PHP的替代方法,例如:
<?php if (true): ?>
<?php endif ?>
<?php foreach ($x as $y): ?>
<?php endforeach ?>
etc. 等等
http://php.net/manual/en/control-structures.alternative-syntax.php http://php.net/manual/en/control-structures.alternative-syntax.php
There's no PHP variation or syntax that allows you to replace <?php
and ?>
with {
and }
. 没有任何PHP变体或语法可让您将
{
<?php
和?>
替换为{
和}
。 If you want that, you'll need to use or write a custom parser for it, which means you're looking at a templating engine. 如果需要,您将需要使用或编写自定义解析器,这意味着您正在寻找模板引擎。 No templating engine, no custom syntax.
没有模板引擎,没有自定义语法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.