Developing a frontend item view for our component
Adding a frontend item view to our component following the Joomla! MVC pattern is like adding an item view to the backend of our component. So, let’s start by creating the src/component/site/View/Project/HtmlView.php
file and defining the namespace and the class:
src/component/site/View/Project/HtmlView.php
<?php namespace Piedpiper\Component\Spm\Site\View\Project; \defined('_JEXEC') or die; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\MVC\View\GenericDataException; class HtmlView extends BaseHtmlView { public $item; }
This file is like the one we created for the list of projects in the previous section. We can make some remarks here. As we are developing the project frontend area, our namespace now points to the Site
folder that was created in the frontend Projects view.
We will add a couple of namespaces that we will use in our display
method, which should...