Daily Archives: February 27, 2010

Joomla

Okay, while I love to write about baseball, occasionally I need to write about something technical. And I just can’t seem to find a good tutorial or document for WordPress Developers trying to work with Joomla Templates. They just treat the problem so very differently.  I’m not going to waste time with the basics like CSS and HTML – and I am by no means an WP or Joomla expert. But this is what I learned.

With wordpress, you can use a combination of plugins and templates to do anything you want. Templates hold the layout, and word press php functions call various WordPress functions to load the templates up with Content.

On the plugin side, you have the notion of events you can “hook”. When WP gets so far in rendering a page, it will call one of your functions to do some additional work. A real common technique is to hook the “add_content” event with a custom function and scan the content for a key words embedded in the post or page and replace those keywords with your stuff.

Joomla behaves differently. With Joomla, templates define the layout of MODULES. Modules can appear anywhere on a page, Components can only appear in the content area of a page. Joomla uses custom tags like in the template to indicate where content will be displayed. Then, in the administrative portion of the tool, you can assign modules to the “names” or positions defined in your Template. Typically the JDOC tags are enclosed in DIV’s (overlays) that are formatted with CSS.

This gives Joomla a LOT of flexibility, but can also make it a real pain to track down where something is being rendered when you try to edit an existing template. The HTML / CSS you may need to edit most likely is NOT in the template, but in one of the Module files. But which one?
As an example, I wrote a simple Hello World template. Basically, it printed Hello Sno! whenver it was called. I had to:

  • Install it
  • Activate it.
  • Assign it to a position.

wpid-image-thumb1.w4jhN3HelpIt.jpg
The code for the plugin (1.5) was simple.
There were 6 files in the plugin and two of them were dummy stubs just to keep people from browsing the directory. It’s a nice trick.
Insert a dummy index.html in any directory you don’t want people to browse!
So the key files were:

  1. helper.php — contains helper logic.
  2. mod_sno.php — Implements module interface.
  3. mod_sno.xml — tells joomla how to load it and use it.
  4. tmpl/default.php — how to render the module data

Okay, this is a drag.  I didn’t have a code plugin for wordpress and the filtering software wiped out my original code.  I reinstalled joomla and lost my plugin.  I know I’ll need to do this again soon so I’ll try to repost the source.  But the big thing I want to capture is the idea that WordPress operates off of hooks – in the WordPress “loop”.  Joomla works differently, modules are activated and then need to be placed into an area of the template for display.

And so it begins…

All the teams are drafted and the practices have started.  Our first practice is tomorrow and I can hardly weight.  Today at school the boys all shared what teams they were on.  A few of the kids even played catch after school.  There’s so much to do and only 4 weeks until the season starts.  I can’t believe how fast the year flew by.  Last year we had this amazing season.  I still remember getting ready for the draft.  I had the number one pick.  But Minors drafts are serpentine.  So I picked number one, then watched the next 15 kids go off the board.  I got two more picks, then watched another 15 kids go by.  And so on and so on through the draft.  When I got home I was convinced I’d messed it all up.
We ended up in first place and won the championship in exciting fashion.  You just never know what is going to happen.
This year the draft did not at all go the way I expected.  No matter how prepared you are, I just can’t seem to predict what other people will do or when they’ll do it.  But that’s what makes it so much fun.  What matters is that we have good kids, good families and good coaches.  And now I can’t wait.  This should be a really fun and competitive season.  To paraphrase my high school football coach, “We’re not teaching the boys baseball, we’re teaching them to be men, we just use baseball to do it.”
Four weeks and counting.  I can’t wait.