class MyView extends JViewLegacy { protected $data; public function display($tpl = null) { $this->data = $this->get('Data'); parent::display($tpl); } }
JLoader::register('MyView', JPATH_COMPONENT . '/views/myview/view.php'); $view = new MyView(); $view->setModel(new Model()); $view->setLayout('default'); $view->display();This example includes the registration of the "MyView" class using the JLoader::register() method. It also includes the creation of a new MyView object, setting the model object using $view->setModel(), setting the layout using $view->setLayout(), and then displaying the view using $view->display(). The output would be the default template file for the MyView class.