Hi,
I'm now doing web programming using PHP. I need to use <?php instead of <?
for PHP scripts.
How do I configure PHP so that it can recognize <? as well??
Thanks in advance
Wing 20 4504
On 2004-01-14, wing <wi**@wing.com> wrote: Hi,
I'm now doing web programming using PHP. I need to use <?php instead of <? for PHP scripts.
How do I configure PHP so that it can recognize <? as well??
short_open_tag = on
But be aware, there are some issues you should be aware of when using
it.
-- http://home.mysth.be/~timvw
"Tim Van Wassenhove" <eu**@pi.be> ¦b¶l¥ó
news:bu************@ID-188825.news.uni-berlin.de ¤¤¼¶¼g... On 2004-01-14, wing <wi**@wing.com> wrote: Hi,
I'm now doing web programming using PHP. I need to use <?php instead of
<? for PHP scripts.
How do I configure PHP so that it can recognize <? as well?? short_open_tag = on
But be aware, there are some issues you should be aware of when using it.
Thanks for your reply but can you please specify what needs to be aware of??
Wing -- http://home.mysth.be/~timvw
"wing" <wi**@wing.com> wrote in message news:<bu**********@news.ust.hk>... Hi,
I'm now doing web programming using PHP. I need to use <?php instead of <? for PHP scripts.
How do I configure PHP so that it can recognize <? as well??
Thanks in advance Wing
Review the following section in *php.ini* file.
[SNIP]
; Allow the <? tag. Otherwise, only <?php and <script> tags are
recognized.
; NOTE: Using short tags should be avoided when developing
applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable
code,
; be sure not to use short tags.
short_open_tag = On
[/SNIP]
You can enable or disable *short_open_tag* (<?) by writing On or Off
respectively in your php.ini file.
--
Cheers,
Rahul
wing wrote: "Tim Van Wassenhove" <eu**@pi.be> ¦b¶l¥ó news:bu************@ID-188825.news.uni-berlin.de ¤¤¼¶¼g... On 2004-01-14, wing <wi**@wing.com> wrote: Hi,
I'm now doing web programming using PHP. I need to use <?php instead of <? for PHP scripts.
How do I configure PHP so that it can recognize <? as well??
short_open_tag = on
But be aware, there are some issues you should be aware of when using it. Thanks for your reply but can you please specify what needs to be aware of??
Wing
If you're using XML, it's a pain in the ass because PHP will think that your
XML is PHP. Seriously, leave short tags off, it's bad style.
Agelmar wrote: If you're using XML, it's a pain in the ass because PHP will think that your XML is PHP. Seriously, leave short tags off, it's bad style.
That is the standard argument (and the only one) I always hear against
short tags, and the argument I hear against using them in a script is
that it doesn't run with short tags off otherwise.
However, since short_open_tags = on is the default setting, turning them
off is (should be) a concious effort, so noone does it without a reason.
All hosting companies I know leave the default setting, so I see
nothing wrong with using the short tags. (For one thing "<?=" looks so
much neater in a template than "<?php echo".)
If someone absolutely has to have the tags off, they can use a per-dir
setting or use one simple sed command to change a whole application to
long tags, so I don't see why I should burden myself (and the template
designers) with long tags just because the style police says so.
LLAP,
Jochen
Jochen Buennagel wrote: Agelmar wrote:
If you're using XML, it's a pain in the ass because PHP will think that your XML is PHP. Seriously, leave short tags off, it's bad style.
That is the standard argument (and the only one) I always hear against short tags, and the argument I hear against using them in a script is that it doesn't run with short tags off otherwise.
However, since short_open_tags = on is the default setting, turning them off is (should be) a concious effort, so noone does it without a reason. All hosting companies I know leave the default setting, so I see nothing wrong with using the short tags. (For one thing "<?=" looks so much neater in a template than "<?php echo".)
If someone absolutely has to have the tags off, they can use a per-dir setting or use one simple sed command to change a whole application to long tags, so I don't see why I should burden myself (and the template designers) with long tags just because the style police says so.
LLAP, Jochen
Just because poor style works doesn't mean you should use it. I can forgoe
all array subscripting in C and just use arrayName + whatever*sizeof(int)
instead of arrayName[whatever] - does that mean I should? <?php will work on
all platforms. <? will not. Thus, if you care about compatibility, it's a no
brainer.
Both <?php and <? are poor style. We should all use <script
language="php"></script> instead.
Uzytkownik "Agelmar" <if**********@comcast.net> napisal w wiadomosci
news:bu************@ID-30799.news.uni-berlin.de... Jochen Buennagel wrote: Agelmar wrote:
If you're using XML, it's a pain in the ass because PHP will think that your XML is PHP. Seriously, leave short tags off, it's bad style. That is the standard argument (and the only one) I always hear against short tags, and the argument I hear against using them in a script is that it doesn't run with short tags off otherwise.
However, since short_open_tags = on is the default setting, turning them off is (should be) a concious effort, so noone does it without a reason. All hosting companies I know leave the default setting, so I see nothing wrong with using the short tags. (For one thing "<?=" looks so much neater in a template than "<?php echo".)
If someone absolutely has to have the tags off, they can use a per-dir setting or use one simple sed command to change a whole application to long tags, so I don't see why I should burden myself (and the template designers) with long tags just because the style police says so.
LLAP, Jochen
Just because poor style works doesn't mean you should use it. I can forgoe all array subscripting in C and just use arrayName + whatever*sizeof(int) instead of arrayName[whatever] - does that mean I should? <?php will work
on all platforms. <? will not. Thus, if you care about compatibility, it's a
no brainer.
Chung Leong wrote: Both <?php and <? are poor style. We should all use <script language="php"></script> instead.
Hmm... actually, that's not a bad suggestion.
Agelmar wrote:
Thus, if you care about compatibility, it's a no brainer.
I've never had any complaints yet (except from the style police).
Chung Leong wrote upsidedown: We should all use <script language="php"></script> instead.
So would I be correct in thinking that you reckon we should take
incompetent editors into consideration? Why? Or did you just forget
the smiley? What really makes you disagree with The Manual?
--
Jock
XML use <? also
Savut
"wing" <wi**@wing.com> wrote in message news:bu**********@news.ust.hk... Hi,
I'm now doing web programming using PHP. I need to use <?php instead of <? for PHP scripts.
How do I configure PHP so that it can recognize <? as well??
Thanks in advance Wing
See http://www.php.net/manual/en/function.is-sarcasm.php for more info.
Uzytkownik "John Dunlop" <jo*********@johndunlop.info> napisal w wiadomosci
news:MP************************@news.freeserve.net ... Chung Leong wrote upsidedown:
We should all use <script language="php"></script> instead.
So would I be correct in thinking that you reckon we should take incompetent editors into consideration? Why? Or did you just forget the smiley? What really makes you disagree with The Manual?
-- Jock
Chung Leong wrote upsidedown: Uzytkownik "John Dunlop" <jo*********@johndunlop.info> napisal w wiadomosci news:MP************************@news.freeserve.net ... Chung Leong wrote upsidedown:
We should all use <script language="php"></script> instead.
So would I be correct in thinking that you reckon we should take incompetent editors into consideration? Why? Or did you just forget the smiley? What really makes you disagree with The Manual?
See http://www.php.net/manual/en/function.is-sarcasm.php for more info.
Right, OK, OK. A smiley would've helped me there! :-] http://www.google.com/googlegroups/p...yle.html#humor http://sic.epfl.ch/SA/News/Smiley.html
But in all earnest, your sarcastic recommendation is surely
reasonable, since AFAIK, the "<script...>" PHP tag is the only one
that is supported everywhere. I have no idea why a not-very-well-
documented, deprecated HTML notation was chosen as PHP tags though --
that'd be another discussion altogether.
The Manual says that even "<?php" won't work on editors that don't
grok processing instructions, and, <sarcasm>lo and behold</sarcasm>,
FrontPage is given as an example. That doesn't stop them from
recommending using "<?php" though. I'm with them on that.
EOD?
--
Jock
John Dunlop wrote: The Manual says that even "<?php" won't work on editors that don't grok processing instructions, and, <sarcasm>lo and behold</sarcasm>, FrontPage is given as an example. That doesn't stop them from recommending using "<?php" though. I'm with them on that.
The Manual also says about short_open_tags: "If you want to use PHP in
combination with XML, you can disable this option."
There is no other reason given for turning them off. The fact that
short_open_tags=on is the default tells me that it is the preferred
setting for most applications, so I use it until someone (except the
style-police) complains.
Jochen
Well, the only situation I can think of is when you use PHP to parse .xml
files.
Otherwise, for maximum compatibility you would do
<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
// PHP stuff
?>
instead of
<?xml version="1.0" encoding="utf-8"?>
<?php
// PHP stuff
?>
anyway, which, of course, removes the reason to turn short tags off.
Besides short tags I also use the alternative control structure syntax (<?
if($login): ?><p> ... </p><? endif; ?>), so I think the style police will
probably shoot me first ;-)
Uzytkownik "Jochen Buennagel" <za*********@buennagel.com> napisal w
wiadomosci news:bu*************@news.t-online.com... John Dunlop wrote:
The Manual says that even "<?php" won't work on editors that don't grok processing instructions, and, <sarcasm>lo and behold</sarcasm>, FrontPage is given as an example. That doesn't stop them from recommending using "<?php" though. I'm with them on that.
The Manual also says about short_open_tags: "If you want to use PHP in combination with XML, you can disable this option."
There is no other reason given for turning them off. The fact that short_open_tags=on is the default tells me that it is the preferred setting for most applications, so I use it until someone (except the style-police) complains.
Jochen
Chung Leong wrote: Besides short tags I also use the alternative control structure syntax (<? if($login): ?><p> ... </p><? endif; ?>), so I think the style police will probably shoot me first ;-)
I do that too in templates, along with copious amounts of <?=$variable?>
Jochen
Regarding this well-known quote, often attributed to Chung Leong's famous
"Fri, 16 Jan 2004 12:46:53 -0500" speech: Well, the only situation I can think of is when you use PHP to parse .xml files.
Otherwise, for maximum compatibility you would do
<?php
echo '<?xml version="1.0" encoding="utf-8"?>'; // PHP stuff
?>
instead of
<?xml version="1.0" encoding="utf-8"?> <?php // PHP stuff ?>
anyway, which, of course, removes the reason to turn short tags off.
Besides short tags I also use the alternative control structure syntax (<? if($login): ?><p> ... </p><? endif; ?>), so I think the style police will probably shoot me first ;-)
Uzytkownik "Jochen Buennagel" <za*********@buennagel.com> napisal w wiadomosci news:bu*************@news.t-online.com... John Dunlop wrote:
The Manual says that even "<?php" won't work on editors that don't grok processing instructions, and, <sarcasm>lo and behold</sarcasm>, FrontPage is given as an example. That doesn't stop them from recommending using "<?php" though. I'm with them on that.
The Manual also says about short_open_tags: "If you want to use PHP in combination with XML, you can disable this option."
There is no other reason given for turning them off. The fact that short_open_tags=on is the default tells me that it is the preferred setting for most applications, so I use it until someone (except the style-police) complains.
Jochen
Of course, if you're running straight, hardcoded XML, then the XML file
vomits whenever you feed it into anything that can't take PHP.
--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com This discussion thread is closed Replies have been disabled for this discussion. Similar topics
1 post
views
Thread by Christian Schmidbauer |
last post: by
|
2 posts
views
Thread by Donald Firesmith |
last post: by
|
4 posts
views
Thread by higabe |
last post: by
|
11 posts
views
Thread by Les Paul |
last post: by
|
11 posts
views
Thread by Wolfgang Kaml |
last post: by
|
9 posts
views
Thread by Eric Lindsay |
last post: by
|
8 posts
views
Thread by Efi Merdler |
last post: by
|
1 post
views
Thread by David Henderson |
last post: by
|
6 posts
views
Thread by Steve |
last post: by
| | | | | | | | | | |