










|
All IO-Controlled pages will use the following standards for writing php, cgi, and xhtml:
These are in no real order, only what I thought of at the time.
- All php tags will be <?php ~~~ ?>. There will be no use of <? without the "php".
- All php tags will be left-aligned, with the following exception: Echoing a single variable can be done
using <?php echo $varname ; ?>
- All echoed text will be inside double-quotes. Do not use single-quotes unless ABSOLUTELY necessary.
- We use echo, not print.
- The only way to include a file is to use include. Do not use require, include_once, or require_once.
- The following "functions" are language constructs and do not use parenthesis (this list is not exhaustive):
- All html/xhtml tag sets will be indented with one space per layer.
- All php/css braces will be indented with one tab per layer.
- Only valid XHTML 1.1 will be used unless absolutely necessary. CSS will be used as often as possible,
provided that browser-compatibility is maintained.
- die () will not be used to terminate a script unless absolutely necessary. If die is used, include
the page's footer before calling die or exit.
- There will be a space:
- Before every semicolon.
- Before the opening parenthesis after a function call, if statement, etc.
- After every comma inside a list of function parameters
- Before and after every mathematical or logical operator, including ones inside SQL statements.
- After a ! (not)
- Before and after the array element operator (=>), dot operator (.), or member function operator (->)
- Braces are to be used at all times, including surrounding one line of code after an if, while, for, etc. statement.
- Braces get their own line, with nothing else on that line. Anything inside a set of braces will be tabbed over.
- Use braces around variables inside double-quoted strings whenever possible.
- All database table names will be lower-case. All fields inside the table will be lower-case.
- Variables will be named $variableName, not $variable_name.
- Constants will be named $CONSTANT_NAME.
- Comments are not required for any code but are strongly recommended.
- All mySQL keywords inside SQL statements will be in all caps. (WHERE, not where or Where).
- All database tables will have a primary auto-increment id field.
- All href's ending with a directory will include a final forward slash (www.site.com/io/), not (www.site.com/io).
|