Plings is a great site helping young people (13-19 yr olds) discover amazing activities and inspiration.
They've added a great new feature to their site, which adds automatic but customised 'Cycle there' links to every one of their listings! (And of course, young people are exactly the kind of people we want to see getting on their bikes more!)
If you run a listings site of any kind, it's really simple to add this to your site too!
Just make your page generate a link like this:
http://www.cyclestreets.net/journey/to/M45+7PB/
or, if you optionally have a building/street name, like this:
http://www.cyclestreets.net/journey/to/M45+7PB/Park+Lane/
i.e. the pattern is:
http://www.cyclestreets.net/journey/to/ + Postcode (URL encoded) + / + Name (optional, URL encoded) + /
If your site uses the language PHP, this would be as follows, using $postcode and $placename as your content values:
<?php // Cycle there link (to CycleStreets) - with postcode and place name shown when the user gets to CycleStreets site echo '<p><a href="http://www.cyclestreets.net/journey/to/' . urlencode (strtolower ($postcode)) . '/' . urlencode (urlencode ($placename)) . '/">Cycle there (CycleStreets)</a></p>'; // or: // Cycle there link (to CycleStreets) - with postcode shown when the user gets to CycleStreets site echo '<p><a href="http://www.cyclestreets.net/journey/to/' . urlencode (strtolower ($postcode)) . '/">Cycle there (CycleStreets)</a></p>'; ?>
The result is a nice, user-friendly page with the destination already filled in!
If you have any other kind of website, e.g. one for your organisation, you can also make a 'cycle to us' link or badge for its contact page – read more.
7 thoughts to “Run a listings site? Add automatic ‘Cycle there’ links!”
Pingback: Tweets that mention CycleStreets » Blog -- Topsy.com
I wonder whether adding the ability to also navigate to a lat/lon would be useful too. The cycle rides in our listings have a lat/lon for their start location and it'd be useful to link to CycleStreets for journey planning purposes.
Good idea, and I've certainly needed that myself sometimes. I'll code it up shortly and let you know!
Gregory – try now! Have added experimental support for lat,lon in the URL, like this:
http://www.cyclestreets.net/journey/to/52.204106,0.117061/
or
http://www.cyclestreets.net/journey/to/52.204106,0.117061/King's+College/
This is a better post for explaining the concept. But readers may want to be aware of the imporvements detailed at http://www.cyclestreets.net/blog/2011/04/11/new-cycle-to-us-links-techy-work-in-progress/
Pingback: Living with Dragons » So new it doesn’t have a postcode…
@Gregory Marler, #5:
Yes, we'll be creating a permanent page in the /link/ section soon which effectively merges the two blog posts into permanent and well-explained documentation.