[drupal-devel] no ?> needed at the end of modules

Gabor Hojtsy gabor at hojtsy.hu
Sat Aug 20 08:47:48 UTC 2005


I am with Steven and Károly completely. I am one of the webmasters at
php.net, where we have a view source link for people to examine and
possibly learn from the site code. Go to

  http://www.php.net/source.php

and click through the include file links in the sidebar. You will notice
that (with only one poor exception), all the files are present without a
closing PHP delimiter. It is not needed, and helps us avoid "headers
already sent" errors, regardless of what intelligent or unintelligent
IDE is used to edit those files. And of couse we (both php.net
webmasters and PHP Manual contributors) encourage that practice. Some RTFM:

  http://php.net/basic-syntax.instruction-separation

By the way, modules maintained by myself do not include a trailing
closing PHP delimiter, look at eg bbcode.module source.

Regards,
Gabor Hojtsy

> I'm completely in Károly's camp. For as long as I can remember, PHP
> treats <?php and ?> as separate markers: one to 'enter PHP mode' and one
> to 'leave PHP mode'. In practice, there is no requirement at all that
> they match up. This makes sense if you consider that the vast majority
> of Drupal files only have PHP code in them, and not
> HTML-with-embedded-PHP. Only the PHPTemplates have that really.
> 
> At least for the settings.php, we should get rid of the ending tag
> because so many people have problems with whitespace after the last tag
> caused by nasty editors. For the other files, it doesn't matter much,
> but I wouldn't care one bit if we removed it there too.
> 
> Steven
> 
> 
> 




More information about the drupal-devel mailing list