How to use { in place of opening tags and } in place of closing tags?
I am an MVC
addict.
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.
I'm wondering how can I make them look good (ie., human readable) without using any TE
? At least I want to replace those <?php
and ?>
for sure, or if you have any other better idea?
It's just a s开发者_如何学Gotart of my web application so please guide me to any better alternative if you have any.
Thanks.
In templates I use the alternatives of PHP like:
<?php if (true): ?>
<?php endif ?>
<?php foreach ($x as $y): ?>
<?php endforeach ?>
etc.
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 }
. 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.
精彩评论