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

Updated guide #17

Open
wants to merge 6 commits into
base: step-3-adding-a-site-menu
Choose a base branch
from
Open
Show file tree
Hide file tree
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
19 changes: 9 additions & 10 deletions helloworld.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<extension type="component"
version="2.5.0"
method="upgrade">
<?xml version="1.0" encoding="utf-8"?>
<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>January 2014</creationDate>
<author>John Doe</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>http://www.example.org</authorUrl>
Expand All @@ -15,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>
Expand All @@ -34,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>
Expand Down
15 changes: 11 additions & 4 deletions site/controller.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<?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');

/**
* 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');

Expand All @@ -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>
4 changes: 1 addition & 3 deletions site/views/helloworld/tmpl/default.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC]]>
</message>
<message>COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC</message>
</layout>
</metadata>
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
Expand All @@ -19,4 +32,4 @@ function display($tpl = null)
// Display the view
parent::display($tpl);
}
}
}