ok heres the registry class i made and use, php5 only
its very simple no bells and whistles
hope that helps
i can only show you the path but you have to walk it
tho you are on the right site 
PHP Code:
<?php
/**
* @name Registry
* @abstract registry is a store for various objects that can be used thruout the application
*/
class Registry implements ArrayAccess{
//registry array
private $registry;
//methods needed for ArrayAccess
public function offsetExists($offset) { return isset($this->registry[$offset]); }
public function offsetGet($offset) { return $this->__get($offset); }
public function offsetSet($offset, $value) { $this->__set($offset, $value); }
public function offsetUnset($offset) { unset($this->registry[$offset]); }
/**
* constructor, initialise values to defaults
*/
public function __construct(){
$this->registry = array();
}
/**
* registry getter
*
* @param string, $key
* @return mixed
* @throws RegistryException
*/
public public function __get($key){
if ( array_key_exists($key, $this->registry) == true) {
return $this->registry[$key];
}
else {
throw new RegistryException('Unable to get object from registry: '.$key );
}
}
/**
* registry setter
*
* @param string, $key
* @param mixed, $value
* @throws RegistryException
*/
public function __set($key, $value){
if ( array_key_exists($key, $this->registry) ) {
throw new RegistryException('Unable to set object in registry: '.$key );
}
else {
$this->registry[$key] = $value;
}
}
/**
* removes an item from the registry
*
* @param string, $key
*/
public function remove($key) {
unset($this->registry[$key]);
}
/**
* checks if a key exists
*
* @param string, $key
* @return boolean
*/
public function exists($key) {
if( isset( $this->registry[$key] ) ){
return true;
}
else {
return false;
}
}
}
/**
* @name RegistryException
* @abstract exception thrown by Registry
*/
class RegistryException extends Exception{
public function __construct($message, $code = 0) {
parent::__construct($message, $code);
}
}
?>
Bookmarks