Re: [PHP] Re: PHP in HTML code

[email protected] (Pete Ford)
Newsgroups php.general
Message-ID <[email protected]>
On 17/03/10 18:59, Tommy Pham wrote:
> On Wed, Mar 17, 2010 at 11:01 AM, Rene Veerman<[email protected]>  wrote:
>> hmm.. seems easier to me to push a filetree of .php's with<?= through
>> the str_replace(), than it is to get all the<?= writers to comply
>> with your wishes, which may not apply to their situation ;-)
>>
>> On Wed, Mar 17, 2010 at 5:14 PM, tedd<[email protected]>  wrote:
>>> At 8:55 PM -0400 3/16/10, Adam Richardson wrote:
>>>>
>>>> That said, I'm not taking exception with those who don't use the short
>>>> tag, only with those who say I shouldn't.
>>>
>>> Exception or not, it's still your choice and using short tags can cause
>>> problems.
>>>
>>> My view, why create problems when there is a solution? Forcing the issue is
>>> a bit like "I'm going to do it my way regardless!" I've traveled that path
>>> too many times in my life. Sometimes it's easier to take the path most
>>> traveled.
>>>
>>> Cheers,
>>>
>>> ted
>>> --
>>> -------
>>> 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
>>>
>>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> http://www.php.net/manual/en/language.basic-syntax.phpmode.php
>
> "There are four different pairs of opening and closing tags which can
> be used in PHP. Two of those,<?php ?>  and<script language="php">
> </script>, are always available. The other two are short tags and ASP
> style tags, and can be turned on and off from the php.ini
> configuration file. As such, while some people find short tags and ASP
> style tags convenient, they are less portable, and generally not
> recommended. "

But the implication there is that they are *only* non-portable *because* they 
can be switched off - there's no other strong reason. Before anyone jumps in 
with XML / XHTML arguments again, those issues are fairly rare and very easily 
worked around. My projects tend to use XHTML doctype because it makes IE7/8 
behave more predictably without a <?xml ?> block, and I always use short tags 
for <?= because the alternative is so ugly! In the rare cases where I generate 
XML from a PHP script, there are workarounds for the <? problem.
I do tend to use <?php for blocks of code - so I guess I'm in the middle camp here.
I also write code to be hosted on dedicated systems that I have full control 
over, so php.ini settings are always in my control (so far...)
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.