Close PHP tags in your EE Templates
If you’ve taken the time to learn some of PHP’s best coding practices, you may have come across the technique of omitting the PHP closing tag to avoid unintentional output of white space. For example, the Zend Framework’s coding standard has adopted this, explaining that:
For files that contain only PHP code, the closing tag (“?>”) is never permitted. It is not required by PHP, and omitting it prevents the accidental injection of trailing white space into the response.
Well ExpressionEngine developers have to ignore this advice: where a template file is set to allow PHP processing, the EE template engine needs the closing tag; if omitted, a parse error is thrown by eval():
Parse error: syntax error, unexpected '<' in /ee/core/core.functions.php(637) : eval()'d code on line XX
Posted on Monday June 1st