Writing Joomla! Extensions. What makes Joomla! extensions unique? They come in self-contained archives non-programmers can install: upload and you're.

Slides:



Advertisements
Similar presentations
PHP + Framework + MVC. What is Framework? Common code - Generic functionality Extensible - Specific functionality Unlike library – Flow Dictated by.
Advertisements

MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
Goals Give you a feeling of what Eclipse is.
J4www/jea Week 3 Version Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models.
Manipulating MySQL Databases with PHP. PHP and mySQL2 Objectives Connect to MySQL from PHP Learn how to handle MySQL errors Execute SQL statements with.
Objectives Connect to MySQL from PHP
Database Software Application
Build a CMS Website. The topics this chapter covers are: What is CMS ? What you can do with CMS The benefits and disadvantages of using a content management.
Dataface API Essentials Steve Hannah Web Lite Solutions Corp.
Danielle Baldwin, ITS Web Services CMS Administrator Application Overview and Joomla 1.5 RC 1 Highlights.
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
UC Berkeley Hello Rails. Review: MVC Goal: separate organization of data (model) from UI & presentation (view) by introducing controller –mediates user.
Internet and Web Application Development Revision.
Working Out with KURL! Shayne Koestler Kinetic Data.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Joomla! Reborn: coding in version 1.5. It finally works the way you always wanted Completely overhauled codebase Improved security Better menu and URL.
How to use in your classrooms? Presented by Steve Adler, Cheryl Butler, Allen Day, and Hyewon Lee 1.
Week 9 PHP Cookies and Session Introduction to JavaScript.
FUNCTIONS AND STORED PROCEDURES & FUNCTIONS AND PROTECTING A DB AND PHP (Chapters 9, 15, 18)
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
® Microsoft Access 2010 Tutorial 1 Creating a Database.
Introduction to MySQL Lab no. 10 Advance Database Management System.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
CAKEPHP Blog tutorial. what you’ll need examples/blog/blog.html 2  A running web server  A database server.
1 Session 3: Flow Control & Functions iNET Academy Open Source Web Programming.
PHP - Basic Language Constructs CSCI 297 Scripting Languages - Day Two.
Module 5: Upgrading to SQL Server 7.0. Overview Planning an Upgrade Preparing to Upgrade Verifying the Upgrade Setting a Compatibility Level.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Fall 2004CSI University of Ottawa Introduction to PHP Basic principles and syntax.
® Microsoft Office 2013 Access Creating a Database.
Active Server Pages (ASP), also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically generated web pages.
XRX Basic CRUDS Create, Read, Update and Delete and Search XML Data Date: May 2011 Dan McCreary President Dan McCreary & Associates
Module 8 : Configuration II Jong S. Bok
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
CSC 405: Web Application Engineering II8.1 Web programming using PHP What have we learnt? What have we learnt? Underlying technologies of database supported.
 Before you continue you should have a basic understanding of the following:  HTML  CSS  JavaScript.
PHP Reusing Code and Writing Functions 1. Function = a self-contained module of code that: Declares a calling interface – prototype! Performs some task.
PHP (cont.). 2 Functions Definition – function name(arguments){... } –syntax name as for a variable, but without $ arguments as for variables –to return.
Content Management Systems. Agenda Week overview Web-page basics The why and what of CMS Typo3.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
UNCLASSIFIED 1 UNITED IN SERVICE TO OUR NATION Manage Enclosure Documents for Requirements Package.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
1 Server Side scripting PHP. 2 What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are.
PHP using MySQL Database for Web Development (part II)
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
Introduction to Dynamic Web Programming
Goals Give you a feeling of what Eclipse is.
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
PHP & MySQL Introduction.
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
Access Creating a Database
PHP / MySQL Introduction
Access Creating a Database
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
ISC440: Web Programming 2 Server-side Scripting PHP 3
Tutorial 6 PHP & MySQL Li Xu
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

Writing Joomla! Extensions

What makes Joomla! extensions unique? They come in self-contained archives non-programmers can install: upload and you're done!

What makes Joomla! extensions unique? Accommodating community: ● Any level of skill can contribute ● No extensions are trivial ● Commercial extensions welcome!

Modules, Plugins, and Components The many modules The component

Modules, Plugins, Components All three working together: Podcast Suite Plugin Module, linking to component

Modules, Plugins, Components How do you execute a component?

1.0.x Components General design: separate logic from output, centralize CRUD

1.0.x Components Example of a native component: Daily Message

1.0.x Components: Daily Message Minimum files

1.0.x Components: Daily Message Typical set of files

Daily Message Frontend dailymessage.php - Required <? defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); global $database;... $starttags =... $endtags = $database->setQuery("SELECT * FROM #__joe_dailymessage WHERE published = '1'"); $rows = $database->loadObjectList(); ?> <? foreach($rows as $row) { if($showdate == 1) echo " ". mosFormatDate($row->date). " "; else echo " "; echo " ". $starttags. $row->message. $endtags. " "; } ?> <? ?>

Daily Message Frontend dailymessage.class.php – database class (used mainly by backend) <? defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); class joeDailyMessage extends mosDBTable { var $id = null; var $message = null; var $date = null; var $published = null; function joeDailyMessage(&$db){ $this->mosDBTable('#__joe_dailymessage', 'id', $db); } class joeDailyMessageConf extends mosDBTable { var $bold = null; var $italic = null; var $underline = null; var $showdate = null; var $configid = null; function joeDailyMessageConf(&$db){ $this->mosDBTable('#__joe_dailymessage_conf', 'configid', $db); } ?>

Daily Message Frontend

Daily Message Backend admin.dailymessage.php - Required <?php defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); require_once( $mainframe->getPath( 'admin_html' ) ); require_once( $mainframe->getPath( 'class' ) );... switch($act) { case "configure": switch($task) { case "save": saveConfiguration($option); break; default: listConfiguration($option); break; } break; default: switch ($task) { case "save" : save($option); break;...

Daily Message Backend admin.dailymessage.php – Required - (contd.) function edit($option, $uid) { global $database; $row = new joeDailyMessage($database); if($uid){ $row -> load($uid[0]); } HTML_joeDailyMessage::edit($option, $row); } function listMessages($option) { global $database; $database->setQuery("SELECT * FROM #__joe_dailymessage ORDER BY id" ); $rows = $database -> loadObjectList(); if ($database -> getErrorNum()) { echo $database -> stderr(); return false; } HTML_joeDailyMessage::listMessages($option, $rows); }

Daily Message Backend admin.dailymessage.html.php class HTML_joeDailyMessage{ function edit( $option, &$row ) { ?> Message: message; ?>" /> Date: date; ?>"> Published: published ); ?> id; ?>" /> " /> <? }...

Daily Message Backend

toolbar.dailymessage.php – Joomla! Backend autosearches for this file <? defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); require_once( $mainframe->getPath( 'toolbar_html' ) ); switch ( $task ) { case 'edit': menuDailyMessage::EDIT_MENU(); break; case 'new': menuDailyMessage::EDIT_MENU(); break; default: switch($act) { case "configure": menuDailyMessage::CONFIGURE_MENU(); break; default: menuDailyMessage::DEFAULT_MENU(); break; } break; } ?>

Daily Message Backend toolbar.dailymessage.html.php <?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); class menuDailyMessage{ function DEFAULT_MENU() { mosMenuBar::startTable(); mosMenuBar::publish('publish'); mosMenuBar::unpublish('unpublish'); mosMenuBar::divider(); mosMenuBar::addNew('new'); mosMenuBar::editList('edit', 'Edit'); mosMenuBar::deleteList( ' ', 'delete', 'Remove' ); mosMenuBar::endTable(); } function EDIT_MENU() { mosMenuBar::startTable(); mosMenuBar::back(); mosMenuBar::spacer(); mosMenuBar::save('save'); mosMenuBar::endTable(); } function CONFIGURE_MENU() { mosMenuBar::startTable(); mosMenuBar::save('save'); mosMenuBar::endTable(); } ?>

Daily Message Backend dailymessage.xml DailyMessage 10/4/2005 Joseph LeBlanc This component in released under the GNU/GPL License dailymessage.php dailymessage.class.php install.dailymessage.php uninstall.dailymessage.php

Daily Message Backend dailymessage.xml - Contd. Daily Message Edit Messages Configure admin.dailymessage.php admin.dailymessage.html.php toolbar.dailymessage.php toolbar.dailymessage.html.php

Daily Message Backend

install.dailymessage.php – Optional <?php function com_install() { } ?> uninstall.dailymessage.php - Optional <? function com_uninstall() { } ?>

1.0.x Components: iWebCal A PHP script that reads in a.ics file (like the ones generated by iCal) and generates an HTML version

iWebCal File Structure Required

iWebCal File Backend

iWebCal Frontend

Daily Message: Moving to 1.5 Almost works out of the box: <?php defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); require_once( $mainframe->getPath( 'admin_html' ) ); require_once( $mainframe->getPath( 'class' ) );... $act = mosGetParam($_REQUEST, 'act', ''); switch($act) {...

Daily Message: Moving to 1.5

Idea in 1.5: Use a controller for logic, create your data models, and create a lot of views

Daily Message: Moving to 1.5 What files would a 1.5 version of Daily Message need? BackendFrontend

Daily Message: Moving to 1.5 admin.dailymessage2.php <?php defined( '_JEXEC' ) or die( 'Restricted access' ); require_once( JPATH_COMPONENT.DS.'controller.php' ); JTable::addTableDir( JPATH_COMPONENT.DS.'tables' ); $controller = new DailyMessageController( array('default_task' => 'showMessages') ); $controller->execute( JRequest::getVar( 'task' ) ); $controller->redirect(); ?>

Daily Message: Moving to 1.5 controller.php <? jimport( 'joomla.application.component.controller' ); class DailyMessageController extends JController { function __construct( $default = array()) { parent::__construct( $default ); $this->registerTask( 'add', 'edit' ); } function save() { global $option, $mainframe; $db=& JFactory::getDBO(); $row =& JTable::getInstance('DailyMessage', $db, 'Table'); if (!$row -> bind($_POST)) { echo " alert('". $row->getError()."'); window.history.go(-1); \n"; exit(); } if (!$row -> store()) { echo " alert('". $row -> getError()."'); window.history.go(-1); \n"; exit(); } $mainframe->redirect("index2.php?option=$option"); }

Daily Message: Moving to 1.5 controller.php - (contd.) function edit() { global $option; $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); $db=& JFactory::getDBO(); $row =& JTable::getInstance('DailyMessage', $db, 'Table'); if($cid){ $row -> load($cid[0]); } require_once( JPATH_COMPONENT.DS.'views'.DS.'message'.DS.'view.php' ); MessageView::edit($option, $row); }...

Daily Message: Moving to 1.5 tables/dailymessage.php & tables/dailymessageconfig.php <?php class TableDailyMessage extends JTable { var $id = null; var $message = null; var $date = null; var $published = null; function __construct( &$db ) { parent::__construct( '#__joe_dailymessage', 'id', $db ); } ?> <?php class TableDailyMessageConfig extends JTable { var $bold = null; var $italic = null; var $underline = null; var $showdate = null; var $configid = null; function __construct( &$db ) { parent::__construct( '#__joe_dailymessage_conf', 'configid', $db ); } ?>

Daily Message: Moving to 1.5 toolbar.dailymessage2.php <?php defined( '_JEXEC' ) or die( 'Restricted access' ); require_once( JApplicationHelper::getPath( 'toolbar_html' ) ); switch ($task) { case 'edit': case 'add': $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); if (!is_array( $cid )) { $cid = array(0); } TOOLBAR_dailymessage2::_EDIT($cid); break; case 'editConfiguration': TOOLBAR_dailymessage2::_CONFIGURE(); break; default: TOOLBAR_dailymessage2::_DEFAULT(); break; } ?>

Daily Message: Moving to 1.5 toolbar.dailymessage2.html.php <?php defined( '_JEXEC' ) or die( 'Restricted access' ); class TOOLBAR_dailymessage2 { function _EDIT() { $cid = JRequest::getVar( 'cid', array(0)); $text = ( $cid[0] ? JText::_( 'Edit' ) : JText::_( 'New' ) ); JMenuBar::title( $text. " Message"); JMenuBar::save(); if ($cid[0]) { JMenuBar::cancel( 'cancel', 'Close' ); } else { JMenuBar::cancel(); } function _DEFAULT() { JMenuBar::title( 'Message Manager' ); JMenuBar::publishList(); JMenuBar::unpublishList(); JMenuBar::deleteList(); JMenuBar::editList(); JMenuBar::addNew(); }... } ?>

Daily Message: Moving to 1.5 views/config/view.php <?php defined( '_JEXEC' ) or die( 'Restricted access' ); class ConfigView { function editConfiguration($option, &$rows) { ?> <? $row = $rows[0]; ?> Bold bold ); ?> Italic italic ); ?> Underline underline ); ?> Show Date showdate ); ?> " /> configid ?> /> <? } ?>

Daily Message: Moving to 1.5

Conclusions ● Joomla! 1.0.x lets you write standard PHP code at the point where you have component.php or component.admin.php, or you can use the framework. ● Joomla! 1.5 also lets you write standard PHP, 1.0.x code under the compatibility later, or you can use the new MVC goodies

Questions?