Saturday, February 11, 2012

[Joomla] Hello World Component ver 3

For this version, I'll add the "V" in MVC

First, create the xml file and name it jchelloworld.xml
<?xml version="1.0" encoding="utf-8"?>
<install type="component" version="1.5" method="upgrade">
  <name>JC Hello World</name>
  <creationDate>February 2012</creationDate>
  <author>Joef Clarin</author>
  <description>JC Hello World</description>

Second, create the entry point file and name it jchelloworld.php
  defined('_JEXEC') or die('Restricted access');
  require_once JPATH_COMPONENT.DS.'controller.php';
  $controller = new JCHelloWorldController();

Third, create the controller and name it controller.php
  defined('_JEXEC') or die('Restricted access');
  class JCHelloWorldController extends JController
    public function display()

Fourth, create a folder and name it views. Inside the views folder, create another folder then name it jchelloworld.

Fifth, create the view file and name it view.html.php
  defined('_JEXEC') or die('Restricted access');

  class JCHelloWorldViewJCHelloWorld extends JView
    public function display()
 echo "hello world!";

Zip the folder and install. You should see the result like this

Download version 3 here

version 1
version 2
version 3
version 4
version 5

1 comment:

  1. I would like to say that this blog really convinced me to update my knowledge about the technology you talk about. Thanks, very good post.
    Best PHP training in chennai
    PHP Training


Related Posts Plugin for WordPress, Blogger...