Reply to Re: Please help a newbie - PHP is running, but code is not executed

Your name:

Reply:


Posted by Toby A Inkster on 10/06/48 12:00

Alan Silver wrote:

> If I went through all the .php files in this collection and did a global
> find and replace for "<?" to "<?php" would that do the trick, or is
> there likely to be anything that might get thrown out by this?

Search and replace ought to be fine. Just remember that there are three-
types of shorttag:

<? ... ?>
<% ... %>
<?= ... ?>

The first two should be replaced with:

<?php ... ?>

The last one should be replaced with:

<?php echo ... ?>

The files you need to be careful with are XML files or PHP files that
generate XML output -- this is because '<?' is a commonly used construct
in XML to introduce a "processing instructions", such as an XML version
hint, or link to a CSS stylesheet or XSLT transformation.

Indeed, it's because of this '<?' confusion with XML that shorttag is
disabled by default in more recent versions of PHP. Careful authors can
author XML with PHP with shorttag enabled and not have any problems. But
not everyone is careful. ;-)

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 16 days, 23:29.]

Gnocchi all'Amatriciana al Forno
http://tobyinkster.co.uk/blog/2008/01/15/gnocchi-allamatriciana/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация