Posts Tagged ‘php’

FirePHP and Joomla

I have another How To Joomla article up: How to debug our Joomla code with FirePHP. Just recently, I discovered a plugin that painlessly adds FirePHP to your Joomla site. After installing it and doing some tests, I decided to write an article. In the midst of writing the article, I went to the FirePHP wiki and found another FirePHP plugin for Joomla released by the Kunena team. This one is even better, with tighter integration into the Joomla environment. I see many possibilities for model debugging and exception handling down the road.

Drupal and WordPress also have FirePHP plugins, as do most of the major stand-alone PHP frameworks. Have a look to see if your favorite is listed before trying to hack FirePHP into your next project.

Working with Content plugins in Joomla 1.5

Earlier this week, I made my debut on HowToJoomla.net with an article on How to Fix Joomla Content Plugins. If you’ve used Joomla since the 1.0 days, you may recall that content plugins acted on both articles and Custom HTML modules. In 1.5, this behavior changed so that Content plugins only act on articles from the Article Manager. Fortunately, there are several options for regaining and controlling this functionality, which I outline in the post. Head over and let me know what you think!

Joomla 1.5 Development Cookbook

When I originally received my copy of the Joomla! 1.5 Development Cookbook, I was in the middle of a large client project. The book sat over on my shelf for a few days waiting to be read. While working on my code, I came to a point where I wanted to add some custom markup to the portion of the HTML document. Although I usually whip out my Joomla Textmate bundle to pull up the right snippet, this wasn’t something I already had preprogrammed and ready to go.

If I learned something, you’ll learn something

I was about to do a Google search, but suddenly remembered that James’ book was in arm’s reach and might have the answer. After turning to the index and finding the topic, I quickly located the exact code I needed to move on. Despite having written a book on Joomla myself, this one came to my rescue at just the right time!

While it took me a while to read all 130 recipes (including time on airplanes, buses, and sitting in my living room), the practical tips and methods were worth it. James covers a wide breadth of Joomla programming topics, matched only by his Joomla Framework reference. Most passages are 2-3 pages long and include relevant information that’s quickly applicable to any Joomla project you’re working on.

Essential information

Two chapters in this book really make it a must-purchase for any Joomla developer. The Multilingual Recipes chapter gives more in-depth information on internationalization and character encodings than any other Joomla reference I’ve seen. Even if you’re only creating a website in one language, it’s imperative that you understand how character encodings work. Current versions of PHP have some shortcomings with handling UTF-8 strings, but Joomla’s special libraries will help you handle them correctly.

Character encodings aside, Keeping it Extensible and Modular is the most useful chapter in the entire book. This chapter is devoted to helping you work with Joomla’s different extension types and getting around some of the shortcomings in 1.5. For instance, James shows you how to create installable libraries by creating a custom type of plugin.

Also, this chapter has a recipe for using the component installation process to install additional extensions. This method allows you to include your modules and plugins inside of your component package; installing multiple extensions in one click. I plan on using it as soon as I get a chance to work on the Podcast Suite!

While the content in this book is very strong, it does have a couple of drawbacks. While most of the recipes have readily usable code that’s straightforward, a few of them don’t make a strong case for why you would use the described method. For instance, there’s a recipe on creating and raising a custom error level. It goes into how you want to avoid conflicting with Joomla and PHP error codes, but it doesn’t explain why you would want to create a custom error level in the first place. Fortunately, most of the recipes have more context.

I’m willing to read more than two pages… seriously.

The biggest disappointment of this book is in the execution of the cookbook format. Having read other “programming cookbooks” in the past, I know that the goal of these kinds of books is to help you find relevant information on specific topics quickly. However, Packt seems to have decided that providing “quick information” means catering to readers with severe cases of attention deficit disorder.

If you try to read entire chapters of this book at a time, you’ll notice that some recipes are almost identical. In Chapter 7, there are individual recipes on setting the HTML document generator, description, and metadata. These add up to less than three pages, but all include the same introduction at the beginning of each. Additionally, all three of these include “See also” references to each other. These would have worked much better as a combined recipe, including a reasonable scenario where you would want to set these things. In its current form, almost half of your reading consists of headers and duplicated information.

I get the feeling that Packt was trying to break all of the topics up into the tiniest pieces possible. This way, they’re able to slap “130 simple but incredibly useful recipes” on the cover and advertise a page count of over 300. This is really taking a short view of things, as James did a wonderful job with the topics he covered. While some marketer is probably pushing for a specific length, I’ve found that the length of a book is not proportional to its usefulness. For instance, I learned far more in 145 pages of Javascript: The Good Parts than I did in nearly 800 pages of Programming Ruby.

Hidden Joomla treasures

Despite the sometimes choppy format, the Joomla! 1.5 Development Cookbook organizes a lot of how-tos missing from Joomla’s online documentation. Anyone coding anything more than the simplest module can benefit from the recipes in this book. James demonstrates expert programming knowledge and delivers it in a very accessible format. The time you’ll save by having this information at hand will offset the cost of purchasing it within the first week. If you’re writing code for Joomla, you need this book.

UPDATE: you can also read a PDF sample of Chapter 2 from Packt’s website.

Book Review: Joomla 1.5 Template Design

Packt Publishing recently sent me a review copy of Joomla 1.5 Template Design by Tessa Blakeley Silver. Since I read most of it away from my computer, I wasn’t able to work through the examples. While I can’t speak to how well the code examples matched the actual process of building the template, I did enjoy reading the book. Coming in at 259 pages before the index, this book has enough content to cover everything you need to know while not wearing out its welcome.

The strongest part shines in Chapter 2, where Tessa introduces her “Rapid Design Comping” technique. This markup-centric approach helps you get your typography and HTML right first, then goes back and creates accompanying graphics. By getting your basic HTML and CSS out of the way up front, you don’t run into issues where you’ve designed a layout in PhotoShop that doesn’t translate to the web. Her coverage of this method is easily worth the price of the whole book.

Another plus is that Tessa incorporates HTML and CSS validation as a part of your template design workflow. Although having valid markup does not guarantee that your design will display properly in all browsers, it does help you avoid many such inconsistencies from the outset. She also covers common browser hacks (mostly to accommodate Internet Explorer 6) and how to use them as sparingly as possible. Finally, she also dives into avoiding quirks mode rendering and how to handle inconsistent renderings of the box model.

Coverage of Joomla-specific code and techniques is extensive, including custom module chrome and template parameters. She includes a complete reference for all <jdoc:include /> tags, as well as CSS selectors output by the Joomla core. Joomla template-specific PHP is also explained, but without going too deep into code that might confuse people without a programming background.

Despite a strong foundation in the fundamentals of Joomla templating and HTML/CSS, the book does have faults. There are some places where Tessa states something pensively (for instance, date formatting in XML manifests on page 138) which makes you wonder whether or not she’s confident about what she’s describing. Conversely, her description of the Model-View-Controller design pattern is very confidently stated, but slightly inaccurate. Fortunately, she describes the relevant details of View overrides correctly. That said, a more consistent voice would make the book easier to read.

Less forgivable is the introduction of the jQuery JavaScript library in Chapter 8. While she does a good job of showing jQuery’s power and simplicity, not once does she mention that Joomla already includes MooTools. Worse, readers are not alerted to the fact that jQuery will clash with MooTools if you don’t add the proper workarounds. While I love jQuery as much as Tessa does (and perhaps more), I was quite shocked by the omission. It’s quite possible that Tessa hasn’t run into this conflict, but it does happen frequently.

Despite a few missteps, this book is a solid introduction to the ins and outs of building a template in Joomla. All of the standard syntax is covered, along with a practical overview of how to structure your HTML and CSS for optimal browser compatibility. Advanced topics are also tackled head on, making this book the most complete reference for building Joomla templates that I know of. If you need to build a template or are curious about the process, this book should definitely be on your shelf.

You can read a sample of the book from Packt’s website [PDF], or purchase the book there as well.

Podcast Suite 1.5 Stable Released

I released a stable copy of Podcast Suite 1.5 today, go get it. On the forums, we managed to find bugs regarding the MIME type being set in the HTTP headers. We also fixed a bug where languages other than English would not get their code in the RSS feed. A few other fixes and enhancements made it in. Thanks goes out to everyone who’s reported bugs on the forum and even offered solutions!

Spring ’09 Conference Roundup

It seems as though the tech conference season starts off every year with SXSW in Austin, comes to a peak in May, then takes a vacation until September. So far, this year has been no different. I recently had the opportunity to attend three conferences within four weeks of each other. A small taste of each follows…

JSConf

Back in February, I began seeing tweets for JSConf on April 24th-25th: the first conference for JavaScript developers. I recently began digging into JavaScript for more than simple effects in jQuery so this sounded interesting. The venue was a mere two metro stops away from my apartment, so I knew I would be kicking myself if I didn’t go.

JSConf absolutely blew me away. The sessions were not simple “here’s how to use jQuery for form validation in your next project” talks. These were the first presentations I saw of JavaScript being used for backend programming as well as frontend. There were speakers representing Objective-J/Cappuccino, Dojo, jQuery, YUI, CouchDB, Titanium, and many other projects. This was also the first I had seen a formal presentation on BOSH and XMPP.

Although there were the presentations about using JavaScript in the backend, the current mainstream use is in the front. Consequently, most of the attendees had expertise in languages other than JavaScript. JSConf managed to get Ruby, PHP, Python, .NET, and other developers in the same room. This really made the conference for me: we were forced to talk about our tools without hiding behind fanboyism.

Another highlight of JSConf was running into Chad Auld and Ozgur Cem Sen from the MiaCMS project. MiaCMS is a fork of the Mambo codebase that has some promising features developing. The JavaScript for the entire codebase has been rewritten in YUI. MiaCMS also sports a REST-style interface you can use to do things like update your site from an iPhone.

Aside from the incredible technical content, the accomodations and after parties were fantastic. Chris and Laura poured a lot of effort into putting this and thought of all the details. They made sure that outlets and wifi were plentiful. The venue they picked was just the right size for shuffling between sessions, uncon talks, hallway tracks, and break room hacking. They even organized a “significant other” track where spouses and children were able to tour DC and Old Town together.

There may be some who would say that this was great for a first year conference; I thought it was amazing for a second or third year conference. I know first hand how difficult it can be to pull off a tech conference, but Chris and Larua passed with flying colors. The sponsors were also incredibly generous and helped the event shine. Looking forward to JSConf 2010!

WordCamp Mid-Atlantic

While people may know me as “the Joomla! guy” in the DC tech community, I’m currently happily using WordPress to power this blog. WordPress is the best tool for doing a stand-alone blog, which is what Design vs. Develop has become. So I felt this was as good an excuse as any to show up for WordCamp Mid-Atlantic on May 18th. (On the other hand, Keith has never used WordPress and simply attended to steal ideas.)

WordCamp Mid-Atlantic (with the rather long Twitter hashtag #wordcampmidatl) was a nice mix between sessions about writing, marketing, and coding. A couple of big announcements from SixApart and the WordPress core team hit that day (TypePad Connect and WP 2.8 beta respectively). The venue was accessible and well-suited for formal talks as well as hallway tracks.

I applaud Aaron’s decision to move the event from DC to Baltimore and refocusing it as a regional conference instead of a city-centric event. DC’s tech community is now much more firmly established than 3-4 years ago. While it would have personally been more convenient to have something located in DC, we’re definitely at a point where we need to connect talent regionally as well as locally.

While the vast majority of the people attending were WordPress users, many were also proficient in Drupal, Joomla!, and other PHP-based systems. The recurring conversation seemed to be that we like using WordPress for straight-up blogs and simple sites, then reach for something else when we want something more involved. Although WordPress is billing itself as a publishing platform as well as a blog, I think we’ll continue to see people using different platforms for different sites. It’s gotten to the point where most are using WordPress for very simple sites (just pages with content), but using something else when integrated shopping carts and forums are wanted.

php|tek

Finally, I flew out to Chicago for php|tek ’09. The guys over at MTA are seasoned conference organizers, with this event being no exception. There was a wide variety of talks: from using XMLReader, to alternative databases, Zend Framework hacks, and even an unconference session on PHP-GTK. As many have commented, php|tek is a nice blend between the PHP developer community and business community.

We had a hackathon where people were writing PHP tests for TestFest, but somehow I was convinced to write patches for Phergie instead. Ok, so I was sitting at the table and was curious more than anything. Phergie is an IRC bot maintained by Matthew Turland that hangs around #phpc on Freenode. It’s quite a non-traditional use of PHP: you have a long-running process that essentially sits in one big loop. It was nice to sit down and write some code purely for fun :)

Aside from the hackathon, you can read about the events and what I thought of them on joind.in. I didn’t get around to rating all of the sessions I went to, but most of the sessions seem to have been ranked by at least one person.

Unfortunately, the wifi was a bit of a wash. I ended up paying for the hotel’s package the first day as I had some side work that needed to go out ASAP. The other days I was usually able to connect, but had difficulty during the hackathon and in the back rooms. However, I think most of the issue with wifi at conferences is the sheer number of heavy Internet users all hitting the same access points at once. As I’ve been telling everyone I meet, Apple should pioneer “conference mode” where you tell your laptop to stop doing backups, software updates, and any other non-crucial network activities.

The biggest announcement at the conference was that php|works, usually held in the fall, will be revamped as CodeWorks 2009 and held in 7 cities (not all at the same time!). It will be an affordable, two-day conference held on a two-week, cross-country tour. I’m planning on going to the one here in the DC area.

In addition to MTA’s CodeWorks, StackOverflow DevDay will be held later that month. More tickets have been opened, so it’s not too late to register!

PHP Appalachia Wrap-up

Earlier this week, I attended PHP Appalachia in Pigeon Forge, TN. We rented this ginormous cabin (scroll all the way down) just to hang out and talk about PHP. I finally met several people who I’ve missed in my failure to show up for Zendcon all these years.

As far as presentations went, Ben Ramsey started with his “frankenstein talk” on REST, focusing on how REST is an architecture for the web itself. Brian DeShong showed us how to rickroll people on any phone using WURFL, PHP, and ffmpeg. Matthew Turland talked about the PHP-based IRC bot named Phergie and corrected me on the pronounciation of my last name (he’s correct, it’s Luh-blon instead of Luh-blon-k).

Brandon Savage led a roundtable discussion (although we were actually seated in the living room on couches) about creating a PHP clone of Trac. Brian Moon talked about the process he uses to load all of the world’s products into the dealnews database. Rob Peck talked about using PHP with Asterisk through the Asterisk Gateway Interface. Finally, Paul Reinheimer gave a presentation on Magento and how to let your open-source contributors know they’re appreciated.

Aside from the talks, we soaked in a hot tub, watched movies, played pool, quizzed each other on PHP trivia, and ate some delicious chicken and sausage gumbo made by Matthew’s wife Whitney. The only thing we didn’t do was spend hours on Internet thanks to satellite connectivity. We talked to each other instead :D

Are you going to ZendCon? Don’t miss UnCon!

If you’re heading out to California for ZendCon in a few weeks, don’t miss ZendUnCon. Keith Casey is heading up this unconference, which already has several interesting talks. I’m now kicking myself for not signing up for ZendCon :(

DC PHP ’08 Highlights

Earlier this week, we had the 2008 DC PHP Conference at George Washington University. A lot of new faces showed up this year and we had quite a few speakers from the local community. Here are some of the sessions I found particularly interesting:

Automated Unit Testing. Mike Lively presented PHP Unit, which I will definitely be using the near future. His presentation on Monday morning was very helpful and made Unit Testing seem much more approachable. He had an afternoon session as well with more PHP Unit tricks (like mock objects and database testing) that I’ll have to look into on down the road.

Fed Up of Framework Hype? Tony Bibbs had a lot of straight-talk about how to choose a framework, why you might want one, and when you could stand to roll your own. He brought up the fact that you need to keep is flexible enough so that your highly talented programmers can stay productive, while keeping it consistent enough for less experienced coders.

SPL Iterators. A lot of Eli White’s presentations I’ve previously seen have been about scaling challenges he’s worked on at Digg. He seemed just as excited to talk about beautiful code :). One of his samples was so short and succinct, I ended up tweeting (forgive the 140 character formatting) it.

Security Centered Design. In his own words, Chris Shiflett hijacked a security talk to cover User Experience. However, he did a good job of tying everything back to security; people have certain expectations for how a web application should behave when they’re logged in. He also plugged myVidoop: the secure, passwordless OpenID provider that some friends of mine work for :).

Also, Keith Casey moderated an IDE/text editor panel. He asked a good set of questions and fortunately there was no physical violence, or even shouting. :D

This was also my first conference where Twitter was out in full force, except when it was down early on Monday morning. You can catch up on most of the tweets here.

PHP TestFest

The PHP/QA team has announced TestFest. I’m trying to organize an event in the DC area, any takers? Post to the list or add a comment here if you’re interested.