A gathering place for those people who add understanding to the world.

Using named anchors with #redirect in forms

Working on a site using the jstabs module this evening I came across a bit of a challenge passing named anchors to the #redirect element of a form. The desired url for redirection in this case was /user/myuser#profile-tab-7.

Asking in #drupal led to the following tidbit from chx. (This is one of the many reasons Drupal is wonderful since Google searching didn't produce results and my experiments and requests of friends didn't produce the answer.) Anyway the challenge is that #redirect causes the form to call drupal_form_redirect() which in turn calls drupal_goto(). The drupal_goto() function takes the path, query and fragment as it's first three arguments.

drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302)

How then to pass these from #redirect. Putting the values in a string doesn't cut it as the special characters end up getting encoded in the URL and it doesn't work. The answer chx pointed out is to use array() to pass the values. The resulting code ends up looking like this:

      $form['#redirect'] = array('user/' .$user->uid, NULL, 'tabs-profile-7 ');

Portland Airport (PDX) and the right way to do Wifi

PDX Wifi map At the Portland airport today traveling after an excellent Portland DrupalCamp. The day got busy yesterday and I fell behind in updating my post but that will come later. In the meantime it is worth sharing how an airport does Wifi the correct way.

So the first thing is that WiFi, yes even in airports, should be free. This is not a service to offer only to those who will pay for it. It is a way of making sure people like your airport and your city so they will come back again. Boise, Portland, Las Vegas and others get this. Unfortunately San Francisco and Denver are amongst the airports that don't realize this.

Some airport WiFi seems to work marginally. Portland on the other hand has a very solid service at PDX. In addition when you sign in instead of a generic page you get a very useful map showing what part of the airport you are located in and where other access points are.

Drupal Camp PDX


Off to a great start at Drupal Camp PDX. Ben Kaplan and Andrew Morton are kicking off the day with what Drupal is and is not. Some great analogs are being used to illustrate what Drupal is and is not. Of course having a Drupal Camp in the beautiful Portland area makes it all the better.  Read more »

Solar Green Lawn Care

Solar Green Lawn CareHow does one green up their lawn while being true to keeping their carbon footprint small? We've got the push mower but it just doesn't leave the grass quite long enough and is tough to keep the blades sharp for really clean cutting. There have been times we've thought about going the lawn service route, but the noise, exhaust and annoyance factor is quite high.

Enter Solar Green Lawn Care. We recently signed up with this great new service. What's so different? Solar Green uses battery powered equipment that is charged from their solar-powered trailer. A few times a year they plug in to the house to run the edger, the one piece of non-battery powered equipment they have. It's a terrific concept and I'm quite happy to have such a service here in Boise.

On top of all that they have very reasonable rates and should be able to keep them reasonable even when the price of gas continues to spiral upwards.

A fun jquery trick

Working on the Forum Thread module I came across a bit of a challenge. On one user's site the call to add an inline javascript file (drupal_add_js()) was being called from nodeapi twice. Since it is calling inline javascript drupal_add_js happily puts the script on the page twice.

In this case the script in question calls a "toggle" function to hide and show the comments on a given forum node. Since the script was there twice it obediently displayed and then immediately hid the comment body. Evidently users aren't keen on this method of speed-reading.

The solution then is simple. Use an external .js file. However, in this case to make the module easy to configure I wanted to allow users the choice of which css element identifies a "comment title". (An aside that the way this works is to hide and show the siblings of the title which does impose some requirements about how the comment is formatted.) So this makes it more complex because I want to include the proper selector in the script and still include it in a file.

To accomplish this I ended up splitting the jQuery function into a couple of separate calls. The first, an inline script, does an addClass to the user-identified comment title class. Then a file-based javascript acts on the newly added class to hide and show the comments as a website user chooses on each page.

It is possible to see the results in action.

Search Twitter feeds

A Drupal Planet post pointed me towards Sumarize.com which makes easy work of searching Twitter. Though it still doesn't make Twitter a really useful tool in most cases it is rather fun to use it to search "follower whores". Now what is a follower whore? It is somebody who wants to crank up their followers so they make their updates "private" and then allow anybody who will "follow" them to see the updates. With the search engine you can't see their feeds but you can see the responses to them and get a pretty good idea what they're saying.

And you can use their tool for sentiment analysis. Though to be honest when I use it and then look at the resulting posts it's a really weak analysis with really tenuous scoring. But tenuous doesn't prevent it being fun.

Boise Drupal user's group meeting

Being the first Thursday of the month the Boise Drupal User Group meeting at the Eagle Public Library. We took a look at several cool projects members of the group are working on. Included among them are these great Drupal modules:

  • Mark it up
  • SuperNav
  • Many cool projects that folks are working on but not ready to have the traffic yet

Having a thriving local Drupal User group is great. Now off to start on getting the pancakes ready for Saturday's pancake breakfast.


This website © 1995-2008 by Brauer Ranch Ltd. Co.
Syndicate content