note 98970 added to control-structures.alternative-syntax
| From: | dmgx dot michael at gmail dot com | Date: | Mon, 19 Jul 2010 15:42:10 +0000 |
| Subject: | note 98970 added to control-structures.alternative-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170970@lists.php.net to get a copy of this message | ||
If you follow MVC design pattern then only your view files should have HTML in them to begin with.
Using the braceless syntax in these files only further separates them thematically from the rest of
the code.
The major advantage of braceless syntax is that braces get lost while jumping into and out of php
mode, especially if you use php short tags (which contrary to what is stated elsewhere, if you are
using htaccess to deploy mod_rewrite in your application it is safe to use short tags in your
application. The server admins CANNOT deny short tags to you while simultaneously granting
mod_rewrite (and why they would even try is beyond me).
Another thing I've noted in the examples above - it is safe to omit the ending semicolon prior
to a script close tag, and it's slightly easier to read. <? endforeach ?> than <?php
endforeach; ?>
----
Server IP: 208.69.120.55
Probable Submitter: 75.147.226.84
----
Manual Page -- http://www.php.net/manual/en/control-structures.alternative-syntax.php
Edit -- https://master.php.net/note/edit/98970
Del: integrated -- https://master.php.net/note/delete/98970/integrated
Del: useless -- https://master.php.net/note/delete/98970/useless
Del: bad code -- https://master.php.net/note/delete/98970/bad+code
Del: spam -- https://master.php.net/note/delete/98970/spam
Del: non-english -- https://master.php.net/note/delete/98970/non-english
Del: in docs -- https://master.php.net/note/delete/98970/in+docs
Del: other reasons-- https://master.php.net/note/delete/98970
Reject -- https://master.php.net/note/reject/98970
Search -- https://master.php.net/manage/user-notes.php