Monthly Archives: February 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.

It’s amazing the free stuff on the internet

Every year I go into this crazy programming mode getting ready for little league.  There’s some thing I see that I think, “Hey I can automate that!”  Three years ago it was the Boundary Checker.  Just enter your address and it would use google maps to tell you if you fell inside the Tempe South Little League Boundary.  Last year it was my draft application.  A stand alone web page that sorted players for the draft.  I loaned it to one coach this year and of course it crashed (sigh), but it was a nifty bit of code.  Based on Tiddlywiki – a stand alone wiki app, the Draft Tool could even save itself to your hard drive.  But to update it for each years draft you needed to be a programmer.  Not very user friendly.
wpid-draft-tool-thumb.0LIpRLax1ehQ.jpg
This year was the biggest project I’ve undertaken yet.  I created a wordpress plugin to allow coaches to log into our website and reserve their fields.  A combination of jQuery based Javascript and wordpress php libraries, it’s a pretty slick application, if I do say so myself.  I just hope it works.  I’ve tested it, but there’s nothing like users to tell you what you did wrong.  If we get through this season without too much heart burn, I’ll turn it loose to the WordPress community.  Usually though these things aren’t all that useful because they are so specific to the league you run.  As soon as you try to make it generic, that’s when it stops being a hobby and it turns into a real job.
But the main reason I wrote, this is I discovered (through one of my favorite websites lifehacker) an extremely cool tool called Jing.  (see jingproject.com).  This little screen capture tool runs on the PC or Mac and it not only lets you grab screens and annotate them – you can also grab Flash movies of you using a program and add audio as well.  This let me create a small video of how to actually use my new reservation tool.  And it only took like 2 minutes.  It’s hard to believe the “free” stuff that’s available these days.  It certainly helps guys like me give back to the communities we love so much.  I could never have done this stuff for Tempe if not for WordPress, jQuery, Google, Jing and I’m sure many other projects and teams I’ve forgotten about.
I can’t wait for the season to start.  This is going to be fun.

The Best Day in Baseball

Well, baseball is right around the corner again.  We just wrapped up the spring try outs.  And for me that has to be one of the best days in baseball.    In Tempe South we call it showcase but what I love about it is that everyone is doing their best.  The boys come out to try and impress, not only the coaches and parents, but their peers and cohorts.  Everyone wants to show what they’ve got.

Despite the poor economy, our league is holding it’s own and will have a solid number of teams and judging by the talent I saw we should have a very balanced and competitive league.  It should be fun this spring around the Tempe baseball diamonds.