Projects: Global Lab : GL Code Documentation
This page last changed on Nov 04, 2007 by pburney.
In general, the Global Lab codebase is a model-view-controller with front-controller pattern. Most site traffic is directed to the file called "application" which includes "foundation.php" which includes the various libraries ("sassy" for website templating, "mystery" for database connectivity), and the "front-controller.php" file. The "front-controller.php" determines which of the page controllers (in the controllers folder) to include. The site navigation is defined in XML files in the "configuration/navigation" directory. Most of the site text strings are in files in the "configuration/lang" directory and are accessed using the gl_get_string function.
You must use the mystery_select/insert/delete queries to communicate with the databases because they perform the proper error checking. You simply provide a query with parameters represented by ? and then an array full of parameters to replace those ?.
All errors for the system are logged to an error file in the /web/logs directory. Do not generate errors. If you're taking a shortcut like relying on PHP to initialize an unset variable to an empty string, prefix the call with an @ symbol to avoid generating the error.
If you're debugging locally, you use trigger_error($message, E_USER_WARNING) to log something to the file, or use the mystery_print_r function to print out a variable recursively to the screen.
All functions should be prefixed with a "gl_" to avoid conflicting with functions defined by other libraries (since PHP doesn't support namespaces).
Code should use tabs and NOT spaces. It should be saved in UTF-8 format to support multiple languages easily. Function names should separate multiple words using lowercase and underscores, NOT CamelCase. Curly braces should be used even when not technically necessary. Always use single quotes for quoting strings, not double quotes unless necessary for interpolation (i.e., use "\r\n" to get a CRLF newline).
Our base CSS is the YUI reset-fonts-grids.css. The reset gets rid of the default styling for the content. The fonts part standardizes the rendering of font sizes (always use percentages for specifying font sizes. There is a "cheat sheet" at the top of the main.css file. The
|Document generated by Confluence on Jan 27, 2014 16:42|