class MyComponentViewMyView extends JViewLegacy { public function display($tpl = null) { // Get the data from the model $data = $this->get('Data'); // Set the data to the view $this->data = $data; parent::display($tpl); } }
class MyComponentViewMyView extends JViewLegacy { public function display($tpl = null) { // Get the data from the model $data = $this->get('Data'); // Set the data to the view $this->data = $data; // Set the path to the template $this->setTemplatePath(JPATH_COMPONENT . '/views/myview/tmpl/custom.php'); parent::display($tpl); } }In this example, we are using a custom template for our view. The `setTemplatePath()` function is used to set the path to the custom template. Package Library JViewLegacy is part of the Joomla MVC (Model-View-Controller) architecture. It is included in the Joomla Framework package library.