This repository has been archived by the owner on Nov 5, 2022. It is now read-only.
forked from joomla-extensions/boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 30
004. Adding a model to the site part
Astrid edited this page Oct 17, 2019
·
16 revisions
Now, we want to create a view on the front end.
Newly created files
components/com_foos/Model/FooModel.php
Modified files
administrator/components/com_foos/foos.xml
components/com_foos/View/Foo/HtmlView.php
components/com_foos/tmpl/foo/default.php
https://github.com/astridx/boilerplate/compare/t3...t4
components/com_foos/Model/FooModel.php
<?php
/**
* @package Joomla.Site
* @subpackage com_foos
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Foos\Site\Model;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
/**
* Foo model for the Joomla Foos component.
*
* @since 1.0.0
*/
class FooModel extends BaseDatabaseModel
{
/**
* @var string message
*/
protected $message;
/**
* Get the message
*
* @return string The message to be displayed to the user
*/
public function getMsg()
{
if (!isset($this->message))
{
$this->message = 'Hello Foo!';
}
return $this->message;
}
}
administrator/components/com_foos/foos.xml