Joomla HTML View
This is the MVC view object. The job of a view object is to handle the setup work for a view template - selecting a layout, fetching Javascript, generating toolbars, and so on.
Admin
File Location: admin/src/View/Hello/HtmlView.php
namespace JohnSmith\Component\HelloWorld\Administrator\View\Hello;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
class HtmlView extends BaseHtmlView
{
function display($tpl = null)
{
parent::display($tpl);
}
}
The string $tpl is the name of the template file to parse. it automatically searches through the template paths.
Site
File Location: site/src/View/Hello/HtmlView.php
namespace JohnSmith\Component\HelloWorld\Site\View\Hello;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
class HtmlView extends BaseHtmlView
{
public function display($template = null)
{
// Call the parent display to display the layout file
parent::display($template);
}
}