The Outline →
Start it
The Back-end
The Front-end
The Module code
Expanding it
Plug-in
Configuring
Packing it up
More →
Tools
Details
Know more
This is intended to be a cheatsheet, of the steps to follow when making an extension (component, module, or plug-in) for Joomla.
it is following the LeBlanc book, making a component for restaurant reviews. So the naming scheme is using the word "reviews". In your own extension, of course replace with your component name.
It is a summary of the process explained in Chapter 12 of
Learning Joomla Extension Development,
by Joseph LeBlanc, Packt Publishing, 2007.
With some information added from
Mastering Joomla 1.5 Extension and Framework Development,
James Kennard, Packt Publishing, 2007.
Making the structure: Before you begin with coding, there are a few files and folders that have to be created, and also a query that has to be run. Then you create a menu item and admin toolbars to access your component – At this point, your component won't actually do anything yet!
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
echo '<div class="componentheading">Restaurant Reviews</div>';
?>
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
echo 'Restaurant Reviews';
?>
INSERT INTO jos_components (name, link, admin_menu_link,
admin_menu_alt, `option`, admin_menu_img, params)
VALUES ('Restaurant Reviews', 'option=com_reviews',
'option=com_reviews', 'Manage Reviews', 'com_reviews',
'js/ThemeOffice/component.png', '');
OR
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
class TOOLBAR_reviews {
function _NEW() {
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
}
function _DEFAULT() {
JToolBarHelper::title( JText::_( 'Restaurant Reviews' ),
'generic.png' );
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::editList();
JToolBarHelper::deleteList();
JToolBarHelper::addNew();
}
}
?>
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once( JApplicationHelper::getPath( 'toolbar_html' ) );
switch($task) {
case 'edit':
case 'add':
TOOLBAR_reviews::_NEW();
break;
default:
TOOLBAR_reviews::_DEFAULT();
break;
}
?>
// create example object
$object = new JObject();
$object->set('name', 'example');
// dump object to popup
dump($object, 'Example Object');
All content not copyright by anyone else is
copyright © 2003–2009 James Walker.
License for use is the GNU Free Documentation License.
Find it:
here in the
License directory
or
at the Free Software Foundation,
www.fsf.org
This content is copyright to the author stated on the page.