Skip to content
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.

Updated guide #15

Open
wants to merge 6 commits into
base: step-2-adding-a-site-view
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions helloworld.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component"
version="2.5.0"
method="upgrade">
<extension type="component" version="3.2.0" method="upgrade">

<name>Hello World!</name>
<!-- The following elements are optional and free of formatting constraints -->
<creationDate>November 2009</creationDate>
<creationDate>December 2013</creationDate>
<author>John Doe</author>
<authorEmail>john.doe@example.org</authorEmail>
<authorUrl>http://www.example.org</authorUrl>
@@ -16,16 +14,16 @@
<!-- The description is optional and defaults to the name -->
<description>Description of the Hello World component ...</description>

<update> <!-- Runs on update; New in 2.5 -->
<update> <!-- Runs on update; New since J2.5 -->
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas>
</update>

<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /site/ in the package -->
to copy FROM in the package to install therefore files copied
in this section are copied from /site/ in the package -->
<files folder="site">
<filename>index.html</filename>
<filename>helloworld.php</filename>
@@ -35,11 +33,11 @@

<administration>
<!-- Administration Menu Section -->
<menu>Hello World!</menu>
<menu link='index.php?option=com_helloworld'>Hello World!</menu>
<!-- Administration Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /admin/ in the package -->
to copy FROM in the package to install therefore files copied
in this section are copied from /admin/ in the package -->
<files folder="admin">
<!-- Admin Main File Copy Section -->
<filename>index.html</filename>
4 changes: 3 additions & 1 deletion site/controller.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

@@ -12,6 +12,8 @@

/**
* Hello World Component Controller
*
* @since 0.0.1
*/
class HelloWorldController extends JControllerLegacy
{
13 changes: 9 additions & 4 deletions site/helloworld.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import joomla controller library
jimport('joomla.application.component.controller');

// Get an instance of the controller prefixed by HelloWorld
$controller = JControllerLegacy::getInstance('HelloWorld');

@@ -13,4 +18,4 @@
$controller->execute($input->getCmd('task'));

// Redirect if set by the controller
$controller->redirect();
$controller->redirect();
10 changes: 9 additions & 1 deletion site/views/helloworld/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<h1><?php echo $this->msg; ?></h1>
<h1><?php echo $this->msg; ?></h1>
23 changes: 18 additions & 5 deletions site/views/helloworld/view.html.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

/**
* HTML View class for the HelloWorld Component
*
* @since 0.0.1
*/
class HelloWorldViewHelloWorld extends JViewLegacy
{
// Overwriting JView display method
/**
* Display the Hello World view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
function display($tpl = null)
{
// Assign data to the view
@@ -19,4 +32,4 @@ function display($tpl = null)
// Display the view
parent::display($tpl);
}
}
}