Joomla!
               Components
                        (Uma Visão Geral)



René Muniz
Desenvolvedor Joomla!
Fábrica Livre
Por que?
Conceitos

• PHP (Doh!)
• OOP (Programação Orientada a Objetos)
• MVC (Model-View-Controller)
• Joomla! Framework
Programação Orientada
   a Objetos (OOP)
Objeto
class StarFighter
  {
              public $size;
              public $color;
              public $wings;
              public $droid;
              public $guns = array();

             function accelerate() {
                 /* Procedure to accelerate here */
             }

             function shoot() {
                 /* Procedure to shoot something here */
             }
  }

  $XWing         = new StarFighter();
  $XWing->size   = "2.2 metters";
  $XWing->color
 = "#FFFFFF";
  $XWing->wings
 = "4";
  $XWing->droid
 = "1";
  $XWing->guns
  = array("regular" => 4, "bomb" => 1);




Classe StarFighter
Model-View-Controller
Modelo == Objeto
View == Interface
Controller == Regras
Joomla! Framework
Joomla!
Joomla’s API   (http://api.joomla.org)

JFactory, JRoute, JText, JVersion, JApplication, JApplicationHelper, JComponentHelper, JController, JMenu,
JModel, JModuleHelper, JPathway, JRouter, JView, JObject, JObservable, JObserver, JTree, JNode, JCache,
JCacheCallback, JCacheOutput, JCachePage, JCacheStorage, JCacheStorageApc, JCacheStorageEaccelerator,
JCacheStorageFile, JCacheStorageMemcache, JCacheStorageXCache, JCacheView, JClientHelper, JFTP,
JLDAP, JDatabase, JDatabaseMySQL, JDatabaseMySQLi, JRecordSet, JTable, JTableARO, JTableAROGroup,
JTableCategory, JTableComponent, JTableContent, JTableMenu, JTableMenuTypes, JTableModule,
JTablePlugin, JTableSection, JTableSession, JTableUser, JDocument, JDocumentError, JDocumentFeed,
JDocumentHTML, 
 JDocumentPDF, JDocumentRaw, JDocumentRenderer, JDocumentRendererAtom,
JDocumentRendererComponent, JDocumentRendererHead, 
 J D o c u m e n t R e n d e r e r M e s s a g e ,
JDocumentRendererModule, JDocumentRendererModules, JDocumentRendererRSS, JBrowser, JRequest,
JResponse, JURI, JError, JException, JLog, JProfiler, JDispatcher, JEvent, JArchive, JArchiveBzip2, JArchiveGzip,
JArchiveTar, JArchiveZip, JFile, JFolder, JPath, JFilterInput, JFilterOutput, JButton, JButtonConfirm,
JButtonCustom, JButtonHelp, JButtonLink, JButtonPopup, JButtonSeparator, JButtonStandard, JEditor,
JElement, JElementCalendar, JElementCategory, JElementEditors, JElementFileList, JElementFolderList,
JElementHelpsites, JElementHidden, JElementImageList, JElementLanguages, JElementList, JElementMenu,
JElementMenuItem, JElementPassword, JElementRadio, JElementSection, JElementSpacer, JElementSQL,
JElementText, JElementTextarea, JElementTimezones, JElementUserGroup, JHtml, JHtmlBehavior,
JHtmlContent, JHtmlEmail, JHtmlForm, JHtmlGrid, JHtmlImage, JHtmlList, JHtmlMenu, JHtmlSelect,
JPagination, JPane, JParameter, JToolBar, JInstaller, JInstallerComponent, JInstallerHelper, JInstallerLanguage,
JInstallerModule, JInstallerPlugin, JInstallerTemplate, JHelp, JLanguageHelper, JLanguage, JMailHelper, JMail,
JPluginHelper, JPlugin, JRegistry, JRegistryFormat, JRegistryFormatINI, JRegistryFormatPHP,
JRegistryFormatXML, JSession, JSessionStorage, JSessionStorageApc, JSessionStorageDatabase,
JSessionStorageEaccelerator, JSessionStorageMemcache, JSessionStorageNone, JSessionStorageXcache,
JAuthentication, JAuthorization, JUserHelper, JUser, JArrayHelper, JBuffer, JDate, JSimpleCrypt, JSimpleXML,
JSimpleXMLElement, JString, JUtility
Getting Started
     Hello World!
Criando um componente
         Para um componente básico
          são necessários 5 arquivos

 • site/hello.php
 • site/controller.php
 • site/views/hello/view.html.php
 • site/views/hello/tmpl/default.php
 • hello.xml
index.php?option=com_hello&view=hello
      /**
 *   @package    Joomla.Tutorials
 *   @subpackage Components
 *   components/com_hello/hello.php
 *   @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
 *   @license    GNU/GPL
*/

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

// Require the base controller

require_once( JPATH_COMPONENT.DS.'controller.php' );

// Require specific controller if requested
if($controller = JRequest::getWord('controller')) {
    $path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php';
    if (file_exists($path)) {
        require_once $path;
    } else {
        $controller = '';
    }
}

// Create the controller
$classname    = 'HelloController'.$controller;
$controller   = new $classname( );

// Perform the Request task
$controller->execute( JRequest::getVar( 'task' ) );

// Redirect if set by the controller
$controller->redirect();


site/hello.php
/**
*    @package    Joomla.Tutorials
*    @subpackage Components
*    @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
*    @license    GNU/GPL
*/

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

jimport('joomla.application.component.controller');

/**
  * Hello World Component Controller
  *
  * @package     Joomla.Tutorials
  * @subpackage Components
  */
class HelloController extends JController
{
     /**
       * Method to display the view
       *
       * @access    public
       */
     function display()
     {
          parent::display();
     }
}

site/controller.php
/**
 *   @package    Joomla.Tutorials
 *   @subpackage Components
 *   @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
 *   @license    GNU/GPL
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view' );

/**
  * HTML View class for the HelloWorld Component
  *
  * @package HelloWorld
  */
class HelloViewHello extends JView
{
     function display($tpl = null)
     {
         $greeting = "Hello World!";
         $this->assignRef( 'greeting', $greeting );

          parent::display($tpl);
     }
}



site/views/hello/view.html.php
<?php
             // No direct access
             defined( '_JEXEC' ) or die( 'Restricted access' );
             ?>

             <h1><?php echo $this->greeting; ?></h1>




site/views/hello/tmpl/default.php
<?xml version="1.0" encoding="utf-8"?>
<install type="component" version="1.5.0">
 <name>Hello</name>
 <!-- The following elements are optional and free of formatting constraints -->
 <creationDate>2007-02-22</creationDate>
 <author>John Doe</author>
 <authorEmail>john.doe@example.org</authorEmail>
 <authorUrl>http://www.example.org</authorUrl>
 <copyright>Copyright Info</copyright>
 <license>License Info</license>
 <!-- The version string is recorded in the components table -->
 <version>1.01</version>
 <!-- The description is optional and defaults to the name -->
 <description>Description of the component ...</description>

 <!-- 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 -->
 <files folder="site">
  <filename>controller.php</filename>
  <filename>hello.php</filename>
  <filename>index.html</filename>
  <filename>views/index.html</filename>
  <filename>views/hello/index.html</filename>
  <filename>views/hello/view.html.php</filename>
  <filename>views/hello/tmpl/default.php</filename>
  <filename>views/hello/tmpl/index.html</filename>
 </files>
</install>

site/views/hello/tmpl/default.php
Perguntas?
             rene.muniz@fabricalivre.com.br




http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1

More Related Content

PDF
Laravel 로 배우는 서버사이드 #5
PPT
Bài 12: JSF-2 - Lập Trình Mạng Nâng Cao
PPT
Advance jquery-plugin
PDF
Introduction to Zend framework
PDF
Javascript in Plone
PDF
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
PDF
UA testing with Selenium and PHPUnit - PFCongres 2013
PDF
Workshop quality assurance for php projects - ZendCon 2013
Laravel 로 배우는 서버사이드 #5
Bài 12: JSF-2 - Lập Trình Mạng Nâng Cao
Advance jquery-plugin
Introduction to Zend framework
Javascript in Plone
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
UA testing with Selenium and PHPUnit - PFCongres 2013
Workshop quality assurance for php projects - ZendCon 2013

What's hot (20)

PPT
Mocking Dependencies in PHPUnit
KEY
Workshop quality assurance for php projects tek12
PDF
PhpBB meets Symfony2
PDF
Functional Structures in PHP
KEY
Unit testing with zend framework PHPBenelux
PPT
Система рендеринга в Magento
PDF
Gravity Forms Hooks & Filters
PDF
The state of Symfony2 - SymfonyDay 2010
PDF
Symfony2 - OSIDays 2010
PDF
Unit testing with zend framework tek11
KEY
Jarv.us Showcase — SenchaCon 2011
PPT
Facelets
PPT
Symfony2 and AngularJS
PDF
Beginning PHPUnit
PDF
Curso Symfony - Clase 4
PDF
Zf2 how arrays will save your project
ODP
Zend Framework 1.9 Setup & Using Zend_Tool
PDF
Intermediate SQL with Ecto - LoneStar ElixirConf 2018
PDF
What's new with PHP7
Mocking Dependencies in PHPUnit
Workshop quality assurance for php projects tek12
PhpBB meets Symfony2
Functional Structures in PHP
Unit testing with zend framework PHPBenelux
Система рендеринга в Magento
Gravity Forms Hooks & Filters
The state of Symfony2 - SymfonyDay 2010
Symfony2 - OSIDays 2010
Unit testing with zend framework tek11
Jarv.us Showcase — SenchaCon 2011
Facelets
Symfony2 and AngularJS
Beginning PHPUnit
Curso Symfony - Clase 4
Zf2 how arrays will save your project
Zend Framework 1.9 Setup & Using Zend_Tool
Intermediate SQL with Ecto - LoneStar ElixirConf 2018
What's new with PHP7
Ad

Similar to Joomla! Components - Uma visão geral (20)

PPTX
Modules and Components Introduction in Joomla! 2.5
PPTX
Techgig Webinar: Joomla Introduction and Module Development June 2012
PPT
Corephpcomponentpresentation 1211425966721657-8
PPT
Core Php Component Presentation
PPT
Advance Component Development by Azrul Rahim
PPT
Joomlapresentation
PPT
Joomlapresentation
PPT
JoomlaEXPO Presentation by Joe LeBlanc
PDF
Intro To Mvc Development In Php
PPT
Getting Started with Zend Framework
PPTX
Develop Basic joomla! MVC component for version 3
PPTX
Simple module Development in Joomla! 2.5
PPTX
Develop advance joomla! MVC Component for version 3
PDF
Symfony2 - WebExpo 2010
PDF
Symfony2 - WebExpo 2010
PDF
php-and-zend-framework-getting-started
PDF
PDF
php-and-zend-framework-getting-started
PDF
php-and-zend-framework-getting-started
Modules and Components Introduction in Joomla! 2.5
Techgig Webinar: Joomla Introduction and Module Development June 2012
Corephpcomponentpresentation 1211425966721657-8
Core Php Component Presentation
Advance Component Development by Azrul Rahim
Joomlapresentation
Joomlapresentation
JoomlaEXPO Presentation by Joe LeBlanc
Intro To Mvc Development In Php
Getting Started with Zend Framework
Develop Basic joomla! MVC component for version 3
Simple module Development in Joomla! 2.5
Develop advance joomla! MVC Component for version 3
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
php-and-zend-framework-getting-started
php-and-zend-framework-getting-started
php-and-zend-framework-getting-started
Ad

Recently uploaded (20)

PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
Modernising the Digital Integration Hub
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
sbt 2.0: go big (Scala Days 2025 edition)
DOCX
search engine optimization ppt fir known well about this
PPT
What is a Computer? Input Devices /output devices
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
TEXTILE technology diploma scope and career opportunities
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Build Your First AI Agent with UiPath.pptx
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PPTX
Configure Apache Mutual Authentication
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Modernising the Digital Integration Hub
Final SEM Unit 1 for mit wpu at pune .pptx
A review of recent deep learning applications in wood surface defect identifi...
sbt 2.0: go big (Scala Days 2025 edition)
search engine optimization ppt fir known well about this
What is a Computer? Input Devices /output devices
Consumable AI The What, Why & How for Small Teams.pdf
A contest of sentiment analysis: k-nearest neighbor versus neural network
Zenith AI: Advanced Artificial Intelligence
TEXTILE technology diploma scope and career opportunities
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Getting started with AI Agents and Multi-Agent Systems
Developing a website for English-speaking practice to English as a foreign la...
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
NewMind AI Weekly Chronicles – August ’25 Week III
Build Your First AI Agent with UiPath.pptx
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Configure Apache Mutual Authentication

Joomla! Components - Uma visão geral

  • 1. Joomla! Components (Uma Visão Geral) René Muniz Desenvolvedor Joomla! Fábrica Livre
  • 3. Conceitos • PHP (Doh!) • OOP (Programação Orientada a Objetos) • MVC (Model-View-Controller) • Joomla! Framework
  • 4. Programação Orientada a Objetos (OOP)
  • 6. class StarFighter { public $size; public $color; public $wings; public $droid; public $guns = array(); function accelerate() { /* Procedure to accelerate here */ } function shoot() { /* Procedure to shoot something here */ } } $XWing = new StarFighter(); $XWing->size = "2.2 metters"; $XWing->color = "#FFFFFF"; $XWing->wings = "4"; $XWing->droid = "1"; $XWing->guns = array("regular" => 4, "bomb" => 1); Classe StarFighter
  • 13. Joomla’s API (http://api.joomla.org) JFactory, JRoute, JText, JVersion, JApplication, JApplicationHelper, JComponentHelper, JController, JMenu, JModel, JModuleHelper, JPathway, JRouter, JView, JObject, JObservable, JObserver, JTree, JNode, JCache, JCacheCallback, JCacheOutput, JCachePage, JCacheStorage, JCacheStorageApc, JCacheStorageEaccelerator, JCacheStorageFile, JCacheStorageMemcache, JCacheStorageXCache, JCacheView, JClientHelper, JFTP, JLDAP, JDatabase, JDatabaseMySQL, JDatabaseMySQLi, JRecordSet, JTable, JTableARO, JTableAROGroup, JTableCategory, JTableComponent, JTableContent, JTableMenu, JTableMenuTypes, JTableModule, JTablePlugin, JTableSection, JTableSession, JTableUser, JDocument, JDocumentError, JDocumentFeed, JDocumentHTML, JDocumentPDF, JDocumentRaw, JDocumentRenderer, JDocumentRendererAtom, JDocumentRendererComponent, JDocumentRendererHead, J D o c u m e n t R e n d e r e r M e s s a g e , JDocumentRendererModule, JDocumentRendererModules, JDocumentRendererRSS, JBrowser, JRequest, JResponse, JURI, JError, JException, JLog, JProfiler, JDispatcher, JEvent, JArchive, JArchiveBzip2, JArchiveGzip, JArchiveTar, JArchiveZip, JFile, JFolder, JPath, JFilterInput, JFilterOutput, JButton, JButtonConfirm, JButtonCustom, JButtonHelp, JButtonLink, JButtonPopup, JButtonSeparator, JButtonStandard, JEditor, JElement, JElementCalendar, JElementCategory, JElementEditors, JElementFileList, JElementFolderList, JElementHelpsites, JElementHidden, JElementImageList, JElementLanguages, JElementList, JElementMenu, JElementMenuItem, JElementPassword, JElementRadio, JElementSection, JElementSpacer, JElementSQL, JElementText, JElementTextarea, JElementTimezones, JElementUserGroup, JHtml, JHtmlBehavior, JHtmlContent, JHtmlEmail, JHtmlForm, JHtmlGrid, JHtmlImage, JHtmlList, JHtmlMenu, JHtmlSelect, JPagination, JPane, JParameter, JToolBar, JInstaller, JInstallerComponent, JInstallerHelper, JInstallerLanguage, JInstallerModule, JInstallerPlugin, JInstallerTemplate, JHelp, JLanguageHelper, JLanguage, JMailHelper, JMail, JPluginHelper, JPlugin, JRegistry, JRegistryFormat, JRegistryFormatINI, JRegistryFormatPHP, JRegistryFormatXML, JSession, JSessionStorage, JSessionStorageApc, JSessionStorageDatabase, JSessionStorageEaccelerator, JSessionStorageMemcache, JSessionStorageNone, JSessionStorageXcache, JAuthentication, JAuthorization, JUserHelper, JUser, JArrayHelper, JBuffer, JDate, JSimpleCrypt, JSimpleXML, JSimpleXMLElement, JString, JUtility
  • 14. Getting Started Hello World!
  • 15. Criando um componente Para um componente básico são necessários 5 arquivos • site/hello.php • site/controller.php • site/views/hello/view.html.php • site/views/hello/tmpl/default.php • hello.xml
  • 16. index.php?option=com_hello&view=hello /** * @package Joomla.Tutorials * @subpackage Components * components/com_hello/hello.php * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 * @license GNU/GPL */ // No direct access defined( '_JEXEC' ) or die( 'Restricted access' ); // Require the base controller require_once( JPATH_COMPONENT.DS.'controller.php' ); // Require specific controller if requested if($controller = JRequest::getWord('controller')) { $path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php'; if (file_exists($path)) { require_once $path; } else { $controller = ''; } } // Create the controller $classname = 'HelloController'.$controller; $controller = new $classname( ); // Perform the Request task $controller->execute( JRequest::getVar( 'task' ) ); // Redirect if set by the controller $controller->redirect(); site/hello.php
  • 17. /** * @package Joomla.Tutorials * @subpackage Components * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 * @license GNU/GPL */ // No direct access defined( '_JEXEC' ) or die( 'Restricted access' ); jimport('joomla.application.component.controller'); /** * Hello World Component Controller * * @package Joomla.Tutorials * @subpackage Components */ class HelloController extends JController { /** * Method to display the view * * @access public */ function display() { parent::display(); } } site/controller.php
  • 18. /** * @package Joomla.Tutorials * @subpackage Components * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1 * @license GNU/GPL */ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.application.component.view' ); /** * HTML View class for the HelloWorld Component * * @package HelloWorld */ class HelloViewHello extends JView { function display($tpl = null) { $greeting = "Hello World!"; $this->assignRef( 'greeting', $greeting ); parent::display($tpl); } } site/views/hello/view.html.php
  • 19. <?php // No direct access defined( '_JEXEC' ) or die( 'Restricted access' ); ?> <h1><?php echo $this->greeting; ?></h1> site/views/hello/tmpl/default.php
  • 20. <?xml version="1.0" encoding="utf-8"?> <install type="component" version="1.5.0"> <name>Hello</name> <!-- The following elements are optional and free of formatting constraints --> <creationDate>2007-02-22</creationDate> <author>John Doe</author> <authorEmail>[email protected]</authorEmail> <authorUrl>http://www.example.org</authorUrl> <copyright>Copyright Info</copyright> <license>License Info</license> <!-- The version string is recorded in the components table --> <version>1.01</version> <!-- The description is optional and defaults to the name --> <description>Description of the component ...</description> <!-- 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 --> <files folder="site"> <filename>controller.php</filename> <filename>hello.php</filename> <filename>index.html</filename> <filename>views/index.html</filename> <filename>views/hello/index.html</filename> <filename>views/hello/view.html.php</filename> <filename>views/hello/tmpl/default.php</filename> <filename>views/hello/tmpl/index.html</filename> </files> </install> site/views/hello/tmpl/default.php
  • 21. Perguntas? [email protected] http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1