473,386 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Setting of <? and <?php

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
Jul 17 '05 #1
20 4606
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
Jul 17 '05 #2
"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

Jul 17 '05 #3
"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
Jul 17 '05 #4
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.
Jul 17 '05 #5
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

Jul 17 '05 #6
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.
Jul 17 '05 #7
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.

Jul 17 '05 #8
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.
Jul 17 '05 #9
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).

Jul 17 '05 #10
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
Jul 17 '05 #11
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

Jul 17 '05 #12
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

Jul 17 '05 #13
Chung Leong wrote:
See http://www.php.net/manual/en/function.is-sarcasm.php for more info.


There are no dashes in function names, so the correct link should be
http://www.php.net/manual/en/function.is_sarcasm.php ;-)

Jochen

Jul 17 '05 #14
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
Jul 17 '05 #15
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

Jul 17 '05 #16
But, my friend, underscores are replaced with dashes for the URL in the PHP
manual.

See http://www.php.net/manual/en/functio...t-contents.php

Uzytkownik "Jochen Buennagel" <za*********@buennagel.com> napisal w
wiadomosci news:bu*************@news.t-online.com...
Chung Leong wrote:
See http://www.php.net/manual/en/function.is-sarcasm.php for more info.


There are no dashes in function names, so the correct link should be
http://www.php.net/manual/en/function.is_sarcasm.php ;-)

Jochen

Jul 17 '05 #17
On Thu, 15 Jan 2004 23:36:34 -0500, Chung Leong hath writ:
See http://www.php.net/manual/en/function.is-sarcasm.php for more info.


*That's* gonna fill up their httpd logs. :-)
Jul 17 '05 #18
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

Jul 17 '05 #19
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

Jul 17 '05 #20
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
Jul 17 '05 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
11
by: Wolfgang Kaml | last post by:
I am not sure if this is more of an expert question, but I am sure that they are out there. I'd like to setup a general application or bin directory on my Win2003.Net Server that will hold some...
9
by: Eric Lindsay | last post by:
I can't figure how to best display little snippets of shell script using <pre>. I just got around to organising to bulk validate some of my web pages, and one of the problems occurs with Bash...
8
by: Efi Merdler | last post by:
Hi, In my code I'm doing some xml transformation, at the end I receive a fully transformed html file. I'm setting the Value property of an hidden field control to have the content of this html...
1
by: David Henderson | last post by:
I know 'disable-output-escaping' has been discussed in the past, but I can't put my finger on any of the threads to see if my current problem is addressed. Sorry for re-asking the question if it...
6
by: Steve | last post by:
I have a div with two - three paragrahs in it. Each paragraph has its own inline style tag with its own font size setting. When I set the last paragraph's font size the font sizes for ALL of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.