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

Step 3 adding a site menu #33

Open
wants to merge 2 commits into
base: step-1-basic-component
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
5 changes: 3 additions & 2 deletions helloworld.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component"
version="2.5.0"
method="upgrade">
Expand All @@ -12,7 +11,7 @@
<copyright>Copyright Info</copyright>
<license>License Info</license>
<!-- The version string is recorded in the components table -->
<version>0.0.1</version>
<version>0.0.3</version>
<!-- The description is optional and defaults to the name -->
<description>Description of the Hello World component ...</description>

Expand All @@ -29,6 +28,8 @@
<files folder="site">
<filename>index.html</filename>
<filename>helloworld.php</filename>
<filename>controller.php</filename>
<folder>views</folder>
</files>

<administration>
Expand Down
13 changes: 13 additions & 0 deletions site/controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
// 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
*/
class HelloWorldController extends JControllerLegacy
{
}
17 changes: 16 additions & 1 deletion site/helloworld.php
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
Hello World
<?php
// 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');

// Perform the Request task
$input = JFactory::getApplication()->input;
$controller->execute($input->getCmd('task'));

// Redirect if set by the controller
$controller->redirect();
1 change: 1 addition & 0 deletions site/views/helloworld/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
5 changes: 5 additions & 0 deletions site/views/helloworld/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<h1><?php echo $this->msg; ?></h1>
8 changes: 8 additions & 0 deletions site/views/helloworld/tmpl/default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>
</layout>
</metadata>
1 change: 1 addition & 0 deletions site/views/helloworld/tmpl/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
22 changes: 22 additions & 0 deletions site/views/helloworld/view.html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
// 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
*/
class HelloWorldViewHelloWorld extends JViewLegacy
{
// Overwriting JView display method
function display($tpl = null)
{
// Assign data to the view
$this->msg = 'Hello World';

// Display the view
parent::display($tpl);
}
}
1 change: 1 addition & 0 deletions site/views/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>