PHP替代语法不起作用


PHP alternative syntax not working

PHP替代语法在我工作的网站上不起作用。它使用的似乎是一个自制的模板框架解决方案(因为我真的不知道它可能是哪一个)。就是大量使用PHP短标签,比如。。。

<? some code goes here ?>

问题是,在模板中,我希望有大块的HTML,它们要么基于简单的IF语句显示,要么不显示,这样做会更干净。。。

<?php if (some condition === true) { ?>
lots of HTML tags and content here
<?php } ?>

(就像在WordPress中一样)而不是通过echoprint来做任何事情。

以下是我以前犯的错误。。。

Parse error: syntax error, unexpected end of file in
/some-directory/Lib/Fw/PageController.php(330) : eval()'d code on line 1

然后。。。

Parse error: syntax error, unexpected '}' in
/some-directory/Lib/Fw/PageController.php(330) : eval()'d code on line 1

那块代码。

有人能就如何"修复"这个框架以允许PHP替代语法提供一些建议吗?

使用:

<?php if (some condition === true): ?>
lots of HTML tags and content here
<?php endif; ?>

foreach和elses也是如此:

http://php.net/manual/en/control-structures.alternative-syntax.php