Question: What are the general requirements for PHP files?
Answer: General requirements for PHP files:
PHP tags: Each PHP file in TYPO3 must use the full (as opposed to short) opening PHP tag. <?php
Line breaks: TYPO3 uses Unix line endings (
, PHP chr(10)). If a developer uses Windows or Mac OS X platform, the editor must be configured to use Unix line endings.
Line length: Very long lines of code should be avoided for questions of readability. A line length of about 130 characters (including spaces) is fine. Longer lines should be split into several lines whenever possible. Each line fragment starting from the second must - compared to the first one - be indented with four space characters more.
Whitespace and indentation: TYPO3 uses space characters to indent source code. Following PSR-2, one indentation level consists of four spaces.
There must be no white spaces in the end of a line. This can be done manually or using a text editor that takes care of this.
Character set: All TYPO3 source files use the UTF-8 character set without byte order mark (BOM)
Comments in the code are highly welcome and recommended. Inline comments must precede the commented line and be indented with the same number of spaces as the commented line.
Usage of opening and closing curly braces is mandatory in all cases where they can be used according to PHP syntax
Conditions: Conditions consist of if, elseif and else keywords.
Question:
What are the general requirements for PHP files? Answer:
General requirements for PHP files:
PHP tags: Each PHP file in TYPO3 must use the full (as opposed to short) opening PHP tag. <?php
Line breaks: TYPO3 uses Unix line endings (
, PHP chr(10)). If a developer uses Windows or Mac OS X platform, the editor must be configured to use Unix line endings.
Line length: Very long lines of code should be avoided for questions of readability. A line length of about 130 characters (including spaces) is fine. Longer lines should be split into several lines whenever possible. Each line fragment starting from the second must - compared to the first one - be indented with four space characters more.
Whitespace and indentation: TYPO3 uses space characters to indent source code. Following PSR-2, one indentation level consists of four spaces.
There must be no white spaces in the end of a line. This can be done manually or using a text editor that takes care of this.
Character set: All TYPO3 source files use the UTF-8 character set without byte order mark (BOM)
Comments in the code are highly welcome and recommended. Inline comments must precede the commented line and be indented with the same number of spaces as the commented line.
Usage of opening and closing curly braces is mandatory in all cases where they can be used according to PHP syntax
Conditions: Conditions consist of if, elseif and else keywords.