Planet Drupal

The Drupal Thickbox Module

Thickbox Image ExampleThickbox is a JavaScript widget built on top of the jQuery library. It displays an image or text in a pop-up window, allowing a user to view the image or text without leaving the original page. This is useful for viewing full-sized pictures by clicking on a thumbnail. It also has a gallery feature for picture groups so the user doesn't have to leave the pop-up box to cycle through a set of full sized pictures.

The Thickbox project page is http://jquery.com/demo/thickbox/. Everything is there on a single page, including implementation instructions for the widgets. It's the single best place to see what Thickbox can do.

The Drupal Thickbox project page is http://drupal.org/project/thickbox. At the time of writing the current module version is V5.x-1.1, implementing Thickbox 3 (the most current is 3.1). In addition to bringing Thickbox to Drupal the module adds Drupal specific integration:

Revealing Assumed Names - Drupal Paths and Aliases

The standard Drupal path is often ugly. Enter the path module, which lets us assign a friendlier alias path. Both the alias and the "real" path, typically called the Drupal path or the internal path, can be used to access the page. Internally Drupal always uses the Drupal path, regardless of which path was used for the original access. For example, if you assign the alias /about to /node/3, it's still /node/3 to Drupal.

The arg function gives us the Drupal path of the current page as component bits. For /node/3, the arg function returns arg(0) = node and arg(1) = 3. Even if the page is accessed via /about, the arg function returns arg(0) = node and arg(1) = 3. To get the Drupal path as a string, you can use $_GET['q'], which would return the string /node/3.

iA's Web Trend Map 2007 Version 2.0

Seen via gnucitizen.org via planet-websecurity.org: Information Architects Japan have produced a cool looking "Web Trend Map" and blogged about it at: Web Trend Map 2007 Version 2.0. They've made both downloadable and online versions available.

iA Webtrends Chart

Be sure to scroll down to the Less Japanese Jokes and More Revealing Coincidences sections where you'll read comments like:

"Google has moved from Shibuya, a humming place for young people, to Shinjuku, a suspicious, messy, Yakuza-controlled, but still a pretty cool place to hang out (Golden Gaya)"

"Skype has conquered a place that doesn’t exist."

Create CCK Node Types Programatically

This is very cool: Programatic CCK Now Possible! (http://groups.drupal.org/node/5272)

I just wanted to point out a very important change to content_copy.module that makes it much more fasible to create CCK field programatically as part of an install profile.

Kudos to joshk.

June 2007 Van Drupalers Meeting: Amazon Web Services

Alex HarfordThe Vancouver League of Drupalers June 2007 meeting topic was Amazon Web Services, of which S3 is arguably the best know. It was given by Alex Harford (pictured right, photo by Roland). We heard about him and his Amazon knowledge though the local Linux community. He graciously accepted our invitation to speak.

Alex's presentation slides, available at http://www.alexharford.com/2007/06/28/drupal-presentation/, are quite good. If you're interested and want an overview of the services I encourage you to browse them.

Some things I learned:

  • The simple storage service, S3, is very straight forward. It has an option to serve your file by bittorret and is scriptable.
  • The SQS: Simple Queue Service was interesting but I wasn't sure why I'd want to use it until I understood what EC2: Elastic Compute Cloud was.
  • EC2: Elastic Compute Cloud is a virtual private server (VPS) service you can rent by the hour. Firing up new instances is a menu click and is scriptable. (Hmmm, need a new build server but only for a couple hours …..)
  • The Mechanical Turk service seemed gimmicky but the idea hamster for one of the attending Drupaler's went into overdrive.
  • There are web and Linux clients for handling files, so no programming is required to get something basic going

Even though I have no current requirement for Amazon Web Services I wish I did. I'd love an excuse to play with them!

Drupal Camp Seattle 2007

Drupal Camp Seattle PictureCongrats and thanks to Robin Barre (robeano), www.rufdesigns.com, and Gregory Heller (GregoryHeller), CivicActions, for a great DrupalCamp Seattle 2007. Good job you two!

Also thanks to the sponsors, CivicActions, Pyramid Communications, and Uptown Espresso for the food and coffee. The coffee was great and the snacks were a first class nice touch.

And we had real wireless this year!!! It wasn't blazing, but it was solid enough for Roland to stream video. Or maybe it wasn't blazing because of Roland's streaming ....

This year's event was a one day affair. On the plus side it meant I could hitch a ride down for the day and not have to worry about a place to stay (though getting up at 4am to do it was brutal). On the down side there was less opportunity to mix. Still, socializing did occur and it was nice to touch bases with some folks I hadn't seen for a while.

Highlights for me were Robin's jQuery session and seeing how Gregory approached creating the demo website.

Theming 101 – The theme_links Function

This article is an in-depth look at the theme_links function. Two notable uses of theme_links are theming a site's primary navigation links and, as of Drupal 5, the link list appearing in a node (nodelinks) i.e., Read More, Comments.

Changing these lists is a common theming requirement. After reading this article you'll be able to quickly determine if theme_links can handle your changes or if a new formatting function is required. You may also find the theme_links function appropriate for other uses in your theme or module.

New Zend Podcast: PHP Abstract

Zend has a new PHP Developer Podcast called PHP Abstract:

PHP Abstract LogoEach episode features a different special guest bringing you their expertise, compressed into a five to seven minute package.

We will be covering a broad range of topics. From security to project planning and hiring good developers and much more.

Their first podcast, PHP Abstract Episode 1 - PHP Security Tips, featured Eli White. What a relief to have someone skip over the same rehashed security material into things less commonly talk about.

Off to a good start in my books. At under 10 minutes a shot I'll be subscribing to check them out. (And have already suggested Dries as a great guest choice! ;)

Creating Links (aka Anchor tags) - The "l" Function

Note: This article covers the l function for Drupal 5. While most of the information is still applicable to Drupal 6, the function call has changed. See http://api.drupal.org/api/function/l/6 for the Drupal 6 version of the call.

Why would anchor tags warrant attention? It's just a text string after all. Concatenate a variable or two with some text to create the link and you're done, right? Maybe.

Do you want to move your code between different Drupal installations? If the answer is yes you need to worry about handling the differences between servers, things like whether clean URLs (1) are enabled or the instance is installed in a base directory (2).

Having to test and determine output based on specific conditions sounds like a good candidate for a function. The Drupal programmers who came before you though so as well, thus we have the "l" function.

The l function brings with it other advantages. If the link is Drupal content with a URL path alias the l function will automatically use the path alias, even if it's passed the Drupal "system" URL. If the URL you're specifying happens to be the current page, it automatically adds class="active", which is very handy when using CSS to theme navigation links.

Theming 101 – The theme_table function

I come to you as one reformed. I will no longer use foreach loops to build tables. At first, I did not know about theme_table. Then I couldn't be bothered to learn about it. Then, after feedback from people whose opinion I respect, I felt compelled to bite the bullet. I wish I hadn't waited so long.

Overview

As the name suggests, theme_table is a Drupal theming function for creating tables. It takes arrays holding the table data and generates the HTML for displaying the table. At their simplest, the input arrays hold text elements. At their most complex, the arrays hold arrays which hold arrays. The various arrays all hold data appropriate to their location, so this isn't as bad as it sounds.

As with all Drupal functions, there's documentation at api.drupal.org. For the Drupal 5 theme_table function specifically: api.drupal.org/api/5/function/theme_table. There's enough there to get you started, but you still have to think a bit. (Which is to say, I had to. Think a bit, that is.) Thinking should be reserved for the problem at hand, not figuring out Drupal, so here's my "overflowing with examples so you can cut and paste" explanation of theme_table.

Pages

Subscribe to RSS - Planet Drupal