Main Joomla Controller File
The DisplayController is main or default controller for a Joomla! component. At present, the component specific controller doesn't do anything more than the parent class already does, which is why the controller class is empty.
Site Part Folder Structure
The folder structure at the site part is similar to the admin part. The site part will have three subfolders:
- forms/
- src/
- Controller
- Model
- View
- tmpl/
The frontend DisplayController Class is similar to the backed class.
1. DisplayController
site/src/Controller/DisplayController.php
use Joomla\CMS\MVC\Controller\BaseController;
class DisplayController extends BaseController
{
protected $default_view = 'planets';
public function display($cachable = false, $urlparams = array())
{
return parent::display($cachable, $urlparams);
}
}
The BaseController is a base class for a Joomla Controller. In order to use controllers, you must extend this class in your component.