PHP.ini graphicWe’re just about to add location-based services to the BeGrand.net website and will be offering a way to search for events close to your post code.

As part of the build we’re using the excellent Location module which provides a proximity search by default. The latest version at time of writing is 6.x-3.1.

We have an exposed block that provides the basic search form and this leads to a Google map displaying events nearby – so you can search for events within 10 miles of CB24 for example. The search works well, but I wanted a way of displaying the filter on the output page. I knew that I could specify PHP code in the header for the view on the page in Views, but struggled to find the code I needed to return the post code, distance and units to show. Finally, I found the answer. Here it is:

$view = views_get_current_view();
if (isset( $view->exposed_input['distance'])) {
echo "

Upcoming events within ";
echo $view->exposed_input['distance']['search_distance']." ";
echo $view->exposed_input['distance']['search_units']."s of ";
echo $view->exposed_input['distance']['postal_code']."

";
} else {
echo "

All upcoming events

";
}

So now, when you search within 10 miles of CB24 the header is displayed as:

Upcoming events within 10 miles of CB24

I’ve added a conditional statement so that an alternative header is displayed if the filter hasn’t been set.

Job done, which is nice.

Bookmark and Share

{ 1 comment }

drupliconI recently needed to check that visitors to a certain node had been referred from a particular page in order to enter a draw. This is my quick and dirty hack to get the working nicely… [read more…]

Bookmark and Share

{ 0 comments }

drupliconI regularly import the Drupal database from our hourly backups into our local development server for testing purposes. That’s all well and good, but I really wanted a way to remove any genuine registered user data from the database so that I keep things nice and anonymous.

[read more…]

Bookmark and Share

{ 1 comment }

Things rocks!

by Mike Richardson on March 29, 2010

in Code

thingsIt’s official. My search for the perfect to-do solution is over. I recently got a MacBook Pro as my primary weapon of choice from my employers and that has allowed me to do what I know is right and use the amazingly simple, but incredibly effective, Things from Cultured Code. It’s the closest I’ve ever come to perfection in terms of UI. It works on all of the platforms I need (including iPhone for meetings – used it this morning!).
[read more…]

Bookmark and Share

{ 1 comment }

Zen and the art of software design

February 18, 2010

The more I develop the more I hate bloatware. Let me explain…
I code using Coda, because it does what I need. I looked at Aptana Studio, Eclipse, PHPIDE and lots of others, before settling on Coda. I signed up for MacHeist last year and got at license for Espresso, but still didn’t use it. Coda [...]

Read the full article →

Anatomy of an Iteration

February 16, 2010

As I’ve previously mentioned, we’re developing BeGrand.net using an iterative, agile methodology, which is nice. However, this is the most misunderstood element of my working life when I talk to other, non-techies about it. So I thought I’d write this post to describe what an iteration, in the terms of BeGrand.net, actually means…
We’ve just pulled [...]

Read the full article →

Adding OG Group name to group posts in Drupal

February 8, 2010

Out of the box, the Drupal Organic Groups module doesn’t put the group name at the top of each group post. This looked a bit odd to use because we use a modified og_tracker block on our homepage to show registered users new group, blog and comment content.
When you clicked on the title of the group post [...]

Read the full article →

Do you need a bug tracker?

February 5, 2010

As we’ve now launched, we’re moving into Phase 2 development, which is nice.
However, we’ve moved from 2 week intensive to 3 week, more reflective, iterations.
We are due to deliver P2 R1 (phase 2, release 1) codename Ellington on 22nd Feb with testing starting on the 15th. I’ve been looking at change/bug management solutions as we [...]

Read the full article →

Connecting to Amazon EC2 Servers using Coda and Transmit

January 22, 2010

We’ve recently moved our servers to a new build on the Amazon EC2 cloud infrastructure which has been an interesting process (more posts coming once we’ve launched the site and have a nice cuppa!)
We’re also big biG bIG BIG fans of Panic’s excellent file transfer client (Transmit) and amazing editor (Coda) both of which are [...]

Read the full article →

Taming Views output with Semantic Views

November 6, 2009

I made great play in the previous post about how we had managed to create minimal, concise and semantic markup but I neglected to refer to the elephant in the room, namely the ultra-div- and class-tastic non-semantic output created by the otherwise awesome and essential Views module.

var addthis_pub = ‘rikabel’;
var addthis_language = ‘en’;var addthis_options = [...]

Read the full article →