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 118 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

If you do
choose to do this, it is normal to define the common MVC elements in the backend.
To access models and views located in the backend from the frontend we can
manually tell Joomla! about additional paths to look in. It is relatively unlikely that
you would want to use the same view in the front and back-end. If you do want to
do this, you should carefully consider your reasons.
This is an example of an overridden controller constructor method. It tells the
controller that there are other places to look for models and views.
/**
* Constructor
*
*/
function __construct()
{
// execute parent's constructor
parent::__construct();
// use the same models as the back-end
$path = JPATH_COMPONENT_ADMINISTRATOR.DS.'models';
$this->addModelPath($path);
// use the same views as the back-end
$path = JPATH_COMPONENT_ADMINISTRATOR.DS.'views'
$this->addViewPath($path);
}
If we use this, the controller will look for models and views in the component's
backend folders, as well as the default frontend folders.


Pages:
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130