Creating a view
Next, we need to create a view on the frontend. By default, Joomla! will be looking for a view with the same name as our component, /components/com_mycomponent/views/mycomponent
, but it is not necessary to use the component name for the default view; you can specify a different name.
Our first view is going to be similar to our preview view that we created in the backend. It's going to display an image, that when clicked, goes to a URL, and it will show details such as company name and phone number.
Create the folder named folios
under /components/com_folio/views/
, and within that, create a folder named tmpl
, both with index.html
files.
Create the view.html.php
file under /components/com_folio/views/folios/
with the following code:
<?php defined('_JEXEC') or die; class FolioViewFolios extends JViewLegacy { protected $items; public function display($tpl = null) { $this->items = $this->get('Items'); if (count($errors = $this->get('Errors')))...