Update:Remora Standards: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 6: | Line 6: | ||
== No new line at EOF == | == No new line at EOF == | ||
[http://pear.php.net/manual/en/standards.file.php Leaving a new line] at the end of a .php file after the ?> will make horrible things happen for HTTP headers. '''Do not follow this standard'''. | [http://pear.php.net/manual/en/standards.file.php Leaving a new line] at the end of a .php file after the ?> will make horrible things happen for HTTP headers. '''Do not follow this standard'''. | ||
: (In that case, the PHP documentation [http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php suggests removing the closing tag at the end of the file altogether].) | |||
= Comments and PHPDoc = | = Comments and PHPDoc = |
Revision as of 18:38, 3 October 2006
Style
Follow the PEAR Coding Standards with one exception:
No new line at EOF
Leaving a new line at the end of a .php file after the ?> will make horrible things happen for HTTP headers. Do not follow this standard.
- (In that case, the PHP documentation suggests removing the closing tag at the end of the file altogether.)
Comments and PHPDoc
- Read and understand the PHPDoc reference when needed.
- Make a concerted effort to [write out comments], especially before function definitions. Bare minimum comments for function defs:
- What it is for
- @param - define all inputs and their type/purpose
- @return - define all retvals and their type/purpose
- // style comments can be used for smaller statements, just footnotes. If the footnote turns into an essay, use /** */
HTML
HTML 4.01 Strict. Close and nest your tags correctly, as if you were writing XHTML.
CSS
Valid
JavaScript
No errors with javascript.options.strict set to true
Testing
l10n
- If the string is a "widget" as defined in the shavictionary: (labels, common navigational elements like "Home" or "Top" or "Next")
- element_name_additional
- If the string is prose for explanations, error messages, instructions
- type_name_additional
- If the string is structural text like headers, titles, breadcrumbs, etc.
- If the string is not in a form:
- namespace_pagename_name_additional
- If the string is inside of a form:
- namespace_pagename_formname_element_name_additional
- If the string is not in a form:
Where:
- namespace is the location in cake of the view, so if it's under /views/developers/ the namespace is "developers"
- pagename is the name of the file, with underscores taken out
- formname is just what you think the form should be called with "form" appended, since cake is actually naming them... (should we make this more specific?)
- name is a unique name for the element (preferably it's id)
- element is the closest tag or parameter, so for an images alt tag it would be "alt". For a label it would be "label"
- additional is anything else needed to make a string unique
- type is a global category, like "error"