My First Joomla Module

June 17th, 2006

Web DesignThis isn’t really a how to, maybe a document of my own confusion. Anyhow, my current project is to add a simple sidebar module to Bottle Cap-O-Rama that displays a current count of all the bottle caps. Sounds like an easy task, however the site runs on Joomla and the ideal way to do this involves several layers of technology.

The first is MySql which I want to learn more about, but essentially it’s a database running on the server. My technical knowledge of MySql has been limited due to my use of content management systems (WordPress, Joomla) which create a nice friendly front end via pHp. This is not always a good thing.

The other night as I was updating this very WordPress blog I was greeted with a truly ugly error about headers already being sent, leaving me unable to update half the site. Luckilly there was support through the WordPress site that directed me to this page. A simple table repair fixed my problem — and reminded me that I really need to get more familiar with MySql and pHp.

I decided the writing of a “bottle cap total” module for Joomla would be one way to accomplish this. After poking around on the server and consulting the MySql reference guide, I wrote my first MySql query:

SELECT COUNT(*) FROM jos_content WHERE sectionid = ‘4′;

…which pulls up the total number of bottle caps in the datbase. Success! But the job isn’t done, as this query needs to be called through Joomla.

So this is where I got stuck. There’s a helpful tutorial online for writing simple Joomla modules. I was able to get “Hello World” working easily enough, but when replacing the query in the tutorial with my own, something got muddled. Unfortunately I think it’s something awry with the installation. Joomla prefers that modules are installed via an uploaded zip file. The package contents seem to be described by an XML file. Each time I uploaded my module, it would say a file was missing that was most certainly there. So I’m stuck at this point, not able to test my module because I can’t get it installed. And I’m unclear how to install a module with manual FTP.

I’m at the point where I’ve made progress but have nothing tangible to show for it, which is frustrating. And although I still think Joomla and WordPress are awesome, there’s definitely a level of trust I’ve handed over, plus a learning curve if you really want to customize either system. The information is out there; just a bit opaque at times when you get the strange error messages.

Trackbacks