Sometimes turn key services/packages just don't seem to work when you initially install them. This was the case when I began putting together EvanPetersen.com. In this post, I'll walk you through how I went about solving a simple, yet particularly annoying problem.
Rather than start from scratch on design, I selected a template (Noble) from YOOtheme and installed it on top of Joomla! 1.5. I was rather unhappy to find that the date on my posts appeared with the month spelled out rather than abbreviated to their unique 3 letter code.
You may be thinking to yourself, "that sure doesn't seem like such a big deal to me...". And you're right, it's not a big deal, but I also believe that if I am using a service that claims to offer a template that works out of the box, then it should work.
So, with a little bit of shell magic and some Google-fu, I managed to "hack" the template so that month names wouldn't exceed their allotted space (Ridiculous, I know).
FINDING THE ROOT OF THE ISSUE
First things first -- I loaded up Google Chrome and navigated to the offending page. Right clicked on the element and chose inspect element. (I use this feature a lot, so expect to see it in most of my future posts).
Because I am using Joomla!, I can't just navigate to a "flat file" and edit the HTML. Instead, I have to search through Joomla!'s seemingly bottomless pit of directories and files. This task, however, is a walk in the park with the combination of shell access and a basic Unix command -- grep.
USING SHELL ACCESS
Now, it would be silly to do a grep on the /www/ folder seeing as how that includes everything in the website. No, it's best to narrow your search to where you think the problem is. In this case, I knew that the problem was somewhere inside the /www/media/zoo/applications/blog/ folder. So I first CDd to the directory /www/media/zoo/applications/blog/.
Now that I'm inside my target directory, I ran a grep against all files for the string "month" and came up with this:
THE HEART OF THE PROBLEM
As much as I like shell access, I broke out my favourite FTP software (FileZilla, look for it in the links to the right) and took down the files full.php and teaser.php from the directory noble/renderer/item/.
I did another search inside the files for the string "month" and found the following line:
Now, at first I was unfamiliar with the %B, but after a quick Google search, I landed on this page: http://en.wikipedia.org/wiki/Date_(Unix)
According to the article, all I had to do was switch the uppercase B to a lowercase b.
And voila! I finally had the functionality I was looking for.
While this post may sound like it took a lot of time, I think I was only at the problem for a couple of minutes. I take this same approach (grep, ftp, Google) with most problems and have had decent success.
Hope you enjoyed this post! If you know of a better way to do something that I mentioned above, please leave a comment. There is always room for improvement.