Joomla is a nice framework, but indeed it’s quite large and can seem cumbersome. I can’t look away from some of the redundancies and odd naming conventions, however, I don’t think it’s complicated. There are tons of books on the subject, and a lot of them are pure garbage. Heres how you make a Joomla component without the fluff. You’ll have results within a few minutes!
Things We’re Not Doing
I’m not telling you how to install Joomla, and I’m probably the only one that’s not going to do that.
We’re not going to be packaging this. Later, you can make the .xml and .zip later, use a tool to automate this, or copy the directory to other sites. Packaging is an important part of long term development (later).
Make sure you’ve got a MySQL database, and a front-end like phpmyadmin, squirrel or some other way to add a row into jos_components. (You can use the mysql client with an INSERT statement too)
We’re only making the back-end (administrator/) interface. You can duplicate your efforts for the front-end (components/com_joombzr)
Inserting into MySQL
Go into phpmyadmin, select your database, then select the jos_component table. In some fashion, insert something like this:
INSERT INTOjos_components(id,name,link,menuid,parent,admin_menu_link,admin_menu_alt,option,ordering,admin_menu_img,iscore,params,enabled) VALUES ( NULL, 'JoomBzr', 'option=com_joombzr', '0', '0', 'option=com_joombzr', 'Site Version', 'com_joombzr', '0', 'js/ThemeOffice/edit.png', '0', '', '1' );
The name of my component is JoomBzr. You can edit this now or afterwards. I’ve messed with component names and directories a lot, and it’s pretty straight forward. I’ve renamed components, and you’ll probably do that at some time too.
Creating Directories
Your going to want to make this directory:
administrator/components/com_joombzr
This is where everything for the back-end and interface .
Later you’ll create one in components/com_joombzr for the front-end. This component only has the back-end, remember?
Creating Hello Joomla on the Back-End
Create administrator/components/com_joombzr/joombzr.php and simply put:
<?php echo "Hello Joomla!";
Notice there is no closing ?>. This is standard practice now for PHP-only scripts. You can now navigate to this component in the back-end (administrator/) and select it from the Components menu. This will get you results within a short time. From here you can create a controller, and some models and views.
No Comments