Closed (fixed)
Project:
mothership
Version:
6.x-1.1
Component:
Code
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2009 at 06:13 UTC
Updated:
6 Jan 2010 at 22:33 UTC
Not a support request really, but out of curiosity why are the php tags at the end of all the mothership .tpl.php files open (example <?php } )? Are there any possible cons to leaving them open?
Comments
Comment #1
nightowl77 commentedThis is not something related to mothership - it is the "drupal way". You'll see that all modules, all themes, all core Drupal files never end with the php closing tag.
The reason for this is simple: if you have a closing tag and accidently press enter after that closing tag you will have one empty line. The webserver sends that empty line to the client the moment it parses it, and most of the time that happens before the session cookie or other header information was sent. The result - you get an ugly error message saying something like "Warning: header information could not be sent, output started at line xxx of file yyy"
Since php automatically considers the end of a file as a php closing tag, it is much better to just never put it there - you can then accidently add as many newlines to the end of the file without it affecting anything.
Comment #2
RobW commentedThanks very much for taking the time to answer. That was informative and will probably save me some headaches down the road.