SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 116 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

ucfirst($entity);
Chapter 4
[ 85 ]
// check if we already instantiated this controller
if (!isset($instances[$class]))
{
// check if we need to find the controller class
if (!class_exists( $class ))
{
jimport('joomla.filesystem.file');
$path = JPATH_COMPONENT.DS.'controllers',
strtolower($entity).'.php';
// search for the file in the controllers path
if (JFile::exists($path)
{
// include the class file
require_once $path;
if (!class_exists( $class ))
{
// class file does not include the class
return JError::raiseWarning('SOME_ERROR',
JText::_('Invalid controller'));
}
}
else
{
// class file not found
return JError::raiseWarning('SOME_ERROR',
JText::_('Unknown controller'));
}
}
// create controller instance
$instances[$class] = new $class();
}
// return a reference to the controller
return $instances[$class];
}
We can now alter the component root file to use the getInstance() method:
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted Access');
// get the base controller
require_once(JPATH_COMPONENT.


Pages:
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6