Your SlideShare is downloading. ×
0
Joomla! User Group FuldaJoomla! erweitern  Plugins, Module und Komponenten erstellen              Achim Fischer           ...
Web-Entwicklung (PHP, RoR, JSP)Software-Entwicklung (Java, C)Mobile Geräte (Android, WP7, iOS)Community Management (italob...
Joomla!PluginsModuleKomponenten
Worin unterscheiden sich die 3 Typen?
Was sind die jeweiligen Einsatzgebiete?
Plugins               Ereignisgesteuert           wie z.B. Datenbank Trigger                   Beispiel:Ein Plugin das bei...
ModuleWerden an Modulpositionen des Templates angezeigt.        Unterstützen häufig Komponenten                   Beispiel:...
KomponentenWerden im Hauptbereich des Templates angezeigt         Entsprechen Applikationen                 Beispiele:    ...
Plugins
PluginsEinklinken in SystemeventsÄndern von Systemfunktionalität ohne ändernvon Systemcode
Pluginsbestehen (mindestens) aus      1 XML Datei      1 PHP Datei
Plugins: marketplace.xml<?xml version="1.0" encoding="utf-8"?><extension version="1.6" type="plugin" group="system" method...
Plugins: marketplace.xml<?xml version="1.0" encoding="utf-8"?><extension version="1.6" type="plugin" group="system" method...
Plugins: GruppenEs gibt 8 Core Groups:                   authentication                   content                   editor...
Plugins: GruppenZu beachten:Nur jeweils 1 Plugin mit demselben Namen proGruppeEs gibt reservierte Namen in den einzelnenGr...
Plugins: marketplace.php      ...	      function onUserAfterSave( $user, $isnew, $success, $msg) {       if ( $success) { ...
Plugins: plg_marketplace.zip                     marketplace.xml                               +                     marke...
Module
Modulebestehen (mindestens) aus      1 XML Datei      1 PHP Datei
Module: mod_marketplace_recentx.xml<?xml version="1.0" encoding="utf-8"?><extension version="1.6" type="module" client="si...
Module: mod_marketplace_recentx.php<?php$_number 	 	 	       = $params->get( number, 5 );$_length 	 	 	       = $params->g...
Module: mod_marketplace_recentx.zip             mod_marketplace_recentx.xml                          +             mod_ ma...
Module: Positionen auf der Website                                     1.                         3.          2.
Komponenten
Komponenten: Werden im Hauptbereich des Templates angezeigt Entsprechen Applikationen/Programmen
Komponenten:               2 Bereiche               Frontend               Backend
Komponenten        bestehen aus1 XML Datei (mindestens)Jeder Menge PHP, SQL, CSS,Javascript, Bilder, ...
Komponenten: marketplace.xml (Auszug)  <?xml version="1.0" encoding="utf-8"?>  <extension method="upgrade" type="component...
Komponenten: install.mysql.utf8.sql (Auszug)  CREATE TABLE IF NOT EXISTS `#__marketplace_users` (      	    `id` int(11) N...
Komponenten: marketplace.php  <?php  // Check to ensure this file is included in Joomla!  defined(_JEXEC) or die(Restricted ...
Komponenten: controller.php  <?php  // Check to ensure this file is included in Joomla!  defined(_JEXEC) or die(Restricted A...
Komponenten: index.php (Index Model, Auszug)  class MarketplaceModelIndex extends JModel {  	  ...  	          function ge...
Komponenten: index.php (Index View)  class MarketplaceViewIndex extends JView {              function display() {        	...
Komponenten: tmpl/default.php (Index Template, Auszug)  foreach ( $this->categories as $category ) : ?>        <tr>  	    ...
Komponenten: Marketplace
Showtime
JED
Joomla! Extensions Directory       extensions.joomla.org
***************************
Kontakt   achim@codingfish.com    www.codingfish.comwww.facebook.com/codingfish   twitter.com/codingfish
Vielen Dank
Joomla erweitern
Joomla erweitern
Joomla erweitern
Joomla erweitern
Upcoming SlideShare
Loading in...5
×

Joomla erweitern

647

Published on

Joomla! erweitern - Eigene Plugins, Module und Komponenten erstellen" (Achim Fischer)

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
647
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Joomla erweitern"

  1. 1. Joomla! User Group FuldaJoomla! erweitern Plugins, Module und Komponenten erstellen Achim Fischer #jugfulda
  2. 2. Web-Entwicklung (PHP, RoR, JSP)Software-Entwicklung (Java, C)Mobile Geräte (Android, WP7, iOS)Community Management (italobikes.com)Joomla! Komponenten: Discussions,Marketplace, Primezilla & Vernissage www.codingfish.com
  3. 3. Joomla!PluginsModuleKomponenten
  4. 4. Worin unterscheiden sich die 3 Typen?
  5. 5. Was sind die jeweiligen Einsatzgebiete?
  6. 6. Plugins Ereignisgesteuert wie z.B. Datenbank Trigger Beispiel:Ein Plugin das beim Anlegen eines neuen Benutzers eine Aktion ausführt
  7. 7. ModuleWerden an Modulpositionen des Templates angezeigt. Unterstützen häufig Komponenten Beispiel: Letzte 10 Einträge im Marktplatz
  8. 8. KomponentenWerden im Hauptbereich des Templates angezeigt Entsprechen Applikationen Beispiele: Diskussionsforum Kleinanzeigenmarkt
  9. 9. Plugins
  10. 10. PluginsEinklinken in SystemeventsÄndern von Systemfunktionalität ohne ändernvon Systemcode
  11. 11. Pluginsbestehen (mindestens) aus 1 XML Datei 1 PHP Datei
  12. 12. Plugins: marketplace.xml<?xml version="1.0" encoding="utf-8"?><extension version="1.6" type="plugin" group="system" method="upgrade"> <name>System - Marketplace</name> <creationDate>June 2011</creationDate> <author>Codingfish (Achim Fischer)</author> <authorEmail>info@codingfish.com</authorEmail> <authorUrl>http://www.codingfish.com</authorUrl> <copyright>All rights reserved.</copyright> <license>GPL 2</license> <version>1.5</version> <description>System Plugin for Codingfish Marketplace</description> <files> <filename plugin="marketplace">marketplace.php</filename> <filename>index.html</filename> </files> <params/> </extension>
  13. 13. Plugins: marketplace.xml<?xml version="1.0" encoding="utf-8"?><extension version="1.6" type="plugin" group="system" method="upgrade"> <name>System - Marketplace</name> <creationDate>June 2011</creationDate> <author>Codingfish (Achim Fischer)</author> <authorEmail>info@codingfish.com</authorEmail> <authorUrl>http://www.codingfish.com</authorUrl> <copyright>All rights reserved.</copyright> <license>GPL 2</license> <version>1.5</version> <description>System Plugin for Codingfish Marketplace</description> <files> <filename plugin="marketplace">marketplace.php</filename> <filename>index.html</filename> </files> <params/> </extension>
  14. 14. Plugins: GruppenEs gibt 8 Core Groups: authentication content editors editors-xtd extension search system user
  15. 15. Plugins: GruppenZu beachten:Nur jeweils 1 Plugin mit demselben Namen proGruppeEs gibt reservierte Namen in den einzelnenGruppen z.B. cache, debug, legacy, log undremember in system
  16. 16. Plugins: marketplace.php ... function onUserAfterSave( $user, $isnew, $success, $msg) { if ( $success) { if ( $isnew) { // insert // add a record to #__marketplace_users $db = JFactory::getDBO(); $sql = "INSERT INTO " . $db->nameQuote(#__marketplace_users) . " SET " . $db->nameQuote(id) . " = " . $user[id] . ", " . "username="" . $user[username] . """; $db->setQuery( $sql); $db->query(); } else { // update // update the user record in #__marketplace_users $db = JFactory::getDBO(); $sql = "UPDATE " . $db->nameQuote(#__marketplace_users) . " SET " . "username="" . $user[username] . "" " . "WHERE " . $db->nameQuote(id) . " = " . $user[id]; $db->setQuery( $sql); $db->query(); } } } ...
  17. 17. Plugins: plg_marketplace.zip marketplace.xml + marketplace.php = plg_marketplace.zip
  18. 18. Module
  19. 19. Modulebestehen (mindestens) aus 1 XML Datei 1 PHP Datei
  20. 20. Module: mod_marketplace_recentx.xml<?xml version="1.0" encoding="utf-8"?><extension version="1.6" type="module" client="site" method="upgrade"> <name>Marketplace RecentX</name> <creationDate>June 2011</creationDate> <author>Codingfish (Achim Fischer)</author> <authorEmail>info@codingfish.com</authorEmail> <authorUrl>http://www.codingfish.com</authorUrl> <copyright>All rights reserved.</copyright> <license>GPL 2</license> <version>1.2</version> <description>Module for Codingfish Marketplace. Displays recent X marketplace entries</description> <files> <filename module="mod_marketplace_recentx">mod_marketplace_recentx.php</filename> <filename>index.html</filename> </files> <config> <fields name="params"> <fieldset name="basic"> ... <field name="number" type="text" default="5" label="# of entries to show" description="How many entries do you want toshow in the recent x box?" /> ... </fieldset> </fields> </config> </extension>
  21. 21. Module: mod_marketplace_recentx.php<?php$_number = $params->get( number, 5 );$_length = $params->get( length, 25 );$_show_poweredby = $params->get( show_poweredby, 1 );$_more = $params->get( more, > );$_label = $params->get( label, 0 );$db =& JFactory::getDBO();$posts = null;if ( $_label == 0) { $query = SELECT e.id AS entryid, e.alias, e.category_id, e.image1 AS image, c.id, c.alias, c.name AS categoryname,e.headline, . CASE WHEN CHAR_LENGTH(e.alias) THEN CONCAT_WS(:, e.id, e.alias) ELSE e.id END aseslug, . CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(:, c.id, c.alias) ELSE c.id END ascslug, . DATE_FORMAT( e.date_created, "%d.%m.%Y %k:%i") AS createdate . FROM #__marketplace_entries e, #__marketplace_categories c . WHERE e.category_id=c.id AND e.published=1 AND c.published=1 . ORDER BY e.date_created DESC LIMIT . $_number;}...
  22. 22. Module: mod_marketplace_recentx.zip mod_marketplace_recentx.xml + mod_ marketplace_recentx.php = mod_ marketplace_recentx.zip
  23. 23. Module: Positionen auf der Website 1. 3. 2.
  24. 24. Komponenten
  25. 25. Komponenten: Werden im Hauptbereich des Templates angezeigt Entsprechen Applikationen/Programmen
  26. 26. Komponenten: 2 Bereiche Frontend Backend
  27. 27. Komponenten bestehen aus1 XML Datei (mindestens)Jeder Menge PHP, SQL, CSS,Javascript, Bilder, ...
  28. 28. Komponenten: marketplace.xml (Auszug) <?xml version="1.0" encoding="utf-8"?> <extension method="upgrade" type="component" version="1.6"> <name>Marketplace</name> <creationDate>October 2011</creationDate> <author>Codingfish (Achim Fischer)</author> <authorEmail>info@codingfish.com</authorEmail> <authorUrl>http://www.codingfish.com</authorUrl> <copyright>All rights reserved</copyright> <license>GPL 2</license> <version>2.2.1</version> <description>Codingfish Marketplace</description> <install> <sql> <file driver="mysql" charset="utf8">install.mysql.utf8.sql</file> <file driver="mysql">install.mysql.sql</file> </sql> </install> <uninstall> <sql> <file driver="mysql" charset="utf8">uninstall.mysql.sql</file> <file driver="mysql">uninstall.mysql.sql</file> </sql> </uninstall> <files folder="site"> <folder>assets</folder> <folder>classes</folder> <folder>includes</folder> <folder>language</folder> <folder>models</folder> <folder>views</folder> <filename>index.html</filename> <filename>marketplace.php</filename> <filename>controller.php</filename> <filename>router.php</filename> </files> ...
  29. 29. Komponenten: install.mysql.utf8.sql (Auszug) CREATE TABLE IF NOT EXISTS `#__marketplace_users` ( `id` int(11) NOT NULL, `username` varchar(150) DEFAULT , `status` tinyint(1) NOT NULL DEFAULT 0, `ads` int(11) NOT NULL DEFAULT 0, `moderator` tinyint(1) NOT NULL DEFAULT 0, `blocked` tinyint(1) NOT NULL DEFAULT 0, `firstname` varchar(255) DEFAULT NULL, `lastname` varchar(255) DEFAULT NULL, `company` varchar(255) DEFAULT NULL, `street` varchar(255) DEFAULT NULL, `zipcode` varchar(50) DEFAULT NULL, `city` varchar(255) DEFAULT NULL, `state` varchar(255) DEFAULT NULL, `country` varchar(255) DEFAULT NULL, `phone` varchar(255) DEFAULT NULL, `mobile` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `website` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `idx_moderator` (`moderator`) ) DEFAULT CHARSET=utf8; ...
  30. 30. Komponenten: marketplace.php <?php // Check to ensure this file is included in Joomla! defined(_JEXEC) or die(Restricted Access); // get the controller require_once(JPATH_COMPONENT.DS.controller.php); // instantiate and execute the controller $controller = new MarketplaceController(); $controller->execute(JRequest::getCmd(task, display)); // redirect $controller->redirect();
  31. 31. Komponenten: controller.php <?php // Check to ensure this file is included in Joomla! defined(_JEXEC) or die(Restricted Access); jimport(joomla.application.component.controller); class MarketplaceController extends JController { function display() { // Set a default view if none exists if ( ! JRequest::getCmd( view ) ) { JRequest::setVar(view, index ); } // display index parent::display(); } }
  32. 32. Komponenten: index.php (Index Model, Auszug) class MarketplaceModelIndex extends JModel { ... function getCategories() { static $items; if (isset($items)) { return $items; } $db =& $this->getDBO(); $query = "SELECT c.id, c.parent_id, c.name, c.alias, c.description, c.image, c.show_image, c.published, (select count(*) from ".$db->nameQuote(#__marketplace_entries)." e WHERE e.category_id = c.id AND e.published = 1) AS counter_entries, (select DATE_FORMAT( max(date_created), %d.%m.%Y) from ".$db- >nameQuote(#__marketplace_entries)." e WHERE e.category_id = c.id AND e.published = 1) AS last_entry_date, (select user_id from ".$db->nameQuote(#__marketplace_entries)." e WHERE e.category_id = c.id AND e.published = 1 ORDER BY DATE_CREATED DESC LIMIT 1) AS last_entry_user_id, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(:, c.id, c.alias) ELSE c.id END as slug FROM ".$db->nameQuote(#__marketplace_categories)." c WHERE c.published=1 ORDER by c.ordering ASC"; $db->setQuery( $query ); $rows = $db->loadObjectList(); $children = array (); if( count( $rows)){ foreach ( $rows as $row) { ... } // class
  33. 33. Komponenten: index.php (Index View) class MarketplaceViewIndex extends JView { function display() { $document =& JFactory::getDocument(); $categories =& $this->get(Categories); $params =& JComponentHelper::getParams(com_marketplace); $menus = &JSite::getMenu(); $menu = $menus->getActive(); if (is_object( $menu )) { $menu_params = new JParameter( $menu->params ); $pageTitle = $menu_params->get( page_title); if (!$menu_params->get( page_title)) { $params->set( page_title, JText::_( Categories ) ); } else { $params->set( page_title, $pageTitle ); } } else { $params->set( page_title, JText::_( Categories ) ); } $document->setTitle( $params->get( page_title ) ); $this->assignRef(categories, $categories); $this->assignRef(params, $params); parent::display(); } ... }
  34. 34. Komponenten: tmpl/default.php (Index Template, Auszug) foreach ( $this->categories as $category ) : ?> <tr> <?php if ( $category->show_image == 0) { // dont show category image if ( $category->parent_id == 0) { // container ?> <td align="center" class="cofiContainer"> <?php } else { ?> <td align="center"> <?php } echo "&nbsp;"; ?> </td> <?php } else { ...
  35. 35. Komponenten: Marketplace
  36. 36. Showtime
  37. 37. JED
  38. 38. Joomla! Extensions Directory extensions.joomla.org
  39. 39. ***************************
  40. 40. Kontakt achim@codingfish.com www.codingfish.comwww.facebook.com/codingfish twitter.com/codingfish
  41. 41. Vielen Dank
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×