home
home home

version 2.x documentation | SF Project Page | downloads | support | bugs | NEWS | projects.

ORBIT42 - BASE :: v1.20

Documentation 1.23

The base class of Orbit42.com is an opensource (free) project released with the hope that others would benifit from a class that contians the basics already. The project is hosted by sourceforge.net. If you like what you have been given please consider donating (see link at bottom of page) to cover the cost of development.

Such basics include iterative functions allowing each parent in the chain to contribute without the need for complex namespace.

Class Variables

$callback an array that allows a call back system to be implimented in a flexable way allowing for more than one type of call back.

$db_conn and $db_used are variables used to track a database connection. The database connection is dealt with at the lowest level and with a little skill a simple change of the base class should allow a change in database engine. This means we have some database abstraction without the cost usually attributed.

$debug_on A switch that allows disabling of the debug system. The debug system also processes error messages.

$debug_level The default is 1. This level displays only error messages. As a guide the following values are recomended:


	1: Basic Error Messages and Similar (BEMS)
	2: As 1 good for class testing 
	3: As 2 but more so, good for class development 
	4: As 3 but really verbose includes a lot of core stuff
	5: AS 4 but really really talkative
	
	

Class functions

function db_live_connect This function was introduced in version 1.20 adding a commonly reused pattern to the core. It takes two arguments that corrispond to $db_conn and $db_used (in that order) both defaulting to 'none' (the default empty value for those two vars). These values are added tot he class scope and then db_connect is called insuring that a connection to a database exists.

function debug This function was introduced in version 1.10 adding a much needed tool to the core. It takes the following values $out, $array, $level. $out is required and is the output messge. $array is option and defaults to an empty string. If it is an array or an object the print_r function is called outputting the array content inside the pre html tags. $level defaults to 1 and should be set to a value that matches the usage. Values of 2 and 3 are generally suitable for deveopment or testing of a new class.
NB: Values above 1 can result in the headers already sent error and are therefore not suitable for a live environment.

function get_ancestors() passes back all of the classes parents, and their parents and so forth back to the ORBIT42 Base class. This function is key tot he entire functionality of the base class system.

function extender_call($func) this allows basic classes to set aside user functions and have those functions used by successive generations of class without tripping over each other. This means that with each layer additional functionality can be added to the same action without any child ever overwritting the functionality of a parent.

function callback($event, $data=array(), $debug_info="") this allows all objects to trigger events in any of it's parents it also allows all children to call an event manager. What does that mean? Just like the extender_call a call back gives the option of all generations haveing access to the data to act on it but a call back uses the $callback array to summon an instence of the call back handler to call external classe and functions.

This callback method is vital to the design pattern of "loose coupling".

function db_sql_return($data, $obj = '') this function must be written for your DB engine. It process the SQL command and returns an sql result. For day-to-day data retreval one should use the more refined db_sql_return_array

function db_sql_return_array($data, $arr = array(), $formof = 'assoc') a wrapper for the db_sql_return function but it carries out the standard fildling to get the returned rows into an array. It then gives you the array so that your class need only deal with the data itself.

function db_connect() this function checks status of $db_conn and $db_used and connects if they do not contain a valid object. This has two advantages. A fall back connection setting and the ability to overwrite the connection settings with another set of connections. Further mroe a good constructor function could becreated to take objects such as $db_conn and $db_used from an earlier controller. (this function must be written for your DB engine).

function db_disconnect() this function must be written for your DB engine. It closes the connection. Generally you will want to leave this to some page controller object (depending on your projects design and specification).

Listed at Hotscripts.com

Support This Project SourceForge.net Logo

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.