Re: [PHP] Re: PHP in HTML code

[email protected] (Adam Richardson)
Newsgroups php.general
Message-ID <[email protected]>
On Thu, Mar 18, 2010 at 11:28 AM, tedd <[email protected]> wrote:

> At 9:34 AM +0000 3/18/10, Pete Ford wrote:
>
>>
>> I do tend to use <?php for blocks of code - so I guess I'm in the middle
>> camp here.
>>
>
>
> Whoa, that's even worse -- make a choice and stick with it -- IMO.
>
> I'm all for consistency and have often found myself redoing dozens of
> scripts because I changed something -- not because the change worked and the
> other didn't, but rather to maintain consistency throughout the project.
>
> Granted, different reasons promote different programming styles. While what
> I do is to solve the problem at hand for the client, it also has to pass
> through my vision of code elegance. I program for myself first and solve the
> client's problems second. I also realize that I have the privilege of doing
> so because my needs are few. I probably wouldn't do well in a production
> oriented environment.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

What Pete described is consistent.

For blocks that merely echo out a variable in templates or views, he uses a
<?=, and in code that's actually doing some manipulation, he uses <?php.

This consistency does make it very easy to discern the difference, saves on
typing, and similar approaches are used in other frameworks (e.g., ASP.Net),
too.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.