[Solar-talk] Namespaces to Solar
Matt M.
goodieboy at gmail.com
Tue Nov 7 09:52:50 PST 2006
Sorry if I sent this out already, I didn't see it in my inbox after hitting
"Send".
Just to see if I'm on the right track... Something like this:?
public function loadClass($class, $concrete=false)
{
if( ! $concrete )
{
$config = self::config('Solar');
$namespaces = $config['namespaces'];
if( ! in_array('H', $namespaces) )
{
$namespaces[] = 'H';
}
foreach($namespaces as $namespace)
{
$namespaced_class = $namespace . '_' . $class;
if( class_exists($namespaced_class) )
{
return $namespaced_class;
}
$class_file = str_replace('_', DIRECTORY_SEPARATOR,
$namespace) . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR,
$class) . '.php';
if( file_exists($class_file) )
{
require_once $class_file;
return $namespaced_class;
}
}
}
return $class;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.killersoft.com/pipermail/solar-talk/attachments/20061107/654a6313/attachment.htm
More information about the solar-talk
mailing list