I had a few minutes of lag time, while waiting for my workstation to reboot and purge itself of virii and adware, so I tinkered for a little bit on a spare laptop. I finally got this Google Maps thing to work, using some tips from the MTGoogleMaps plugin creator, Nick Punter. Apparently, when using MTGoogleMaps and Canadian addresses, the plugin goes to the Geocoder.ca service. For this to work, you've got to insert commas between each part of the address. So instead of "123 Foobar St., Toronto, ON", you've got to use something like "123, Foobar St., Toronto, ON".

Once I confirmed that the plugin worked, I tried to do something a little more creative, like configuring it so that it would only show a Google Map in my MT blog if I wanted it there. I mean, how useless is it to render a static Google Map in your dynamically generated Main Index template? You end up with a fixed map in every single entry on your main page. What if you want a different Google Map for every blog entry? What if you don't want to display a Google Map in all of your entries? How about having a map display only when a certain field is filled in?

Well, it's a little more difficult than it looks. Here's why: Say I wanted to use the <MTEntryIfExtended> tag, so that the map would only show up in the "ExtendedEntry" section if some text were placed in the "ExtendedEntry" section -- say, a map address. That's great, but when it renders, the map code will render in the section along with the address from which the map is rendered, making a loop, and making a failure out of me. Luckily the plugin is smart enough not to render the map.

The trick is, then, to put the rendering address in another section, such as in the "EntryExcerpt" field, which I don't normally use. That way, the map address and info can be pulled from the same section, if I insert text into the "ExtendedEntry" field. Here's how the Main Index template looks:

google_maps_code.jpg

Here's how the entry looks:

google_maps_entry.jpg

And finally, here's how it rendered:

google_maps_successful.jpg

Pretty neat. Of course, this only works on the front page of the blog. If you click on the permalink, the Google Map doesn't render, and you get "ggggg" instead.

Don't know if I'm going to put this into the main blog just yet. Doing this pretty much locks both the "ExtendedEntry" and the "EntryExcerpt" fields into the MTGoogleMaps mechanism. If I ever start up a travel blog, it'd be useful there.



Mailing List Signup

What? There's a mailing list? Sign up for the Mailing List

About Me

I suppose if you've been reading my site for any length of time, you're probably curious to know who I am, and why I think people will read my blog. Online, I'm known as Zuckervati, mostly because it's easy...
» More ...

Follow Me on Twitter


Recent Entries

Tag Cloud

politik / film / video / skeptic / cewl / techno / humour / haxors / nosh / can-con / gaming / religion / weird / sex / funny / eco / music / stupid / photos / cocktails / George Bush / blogosphere / flickr / travel / evolution / politics / creationism / creationist / mobile / awful / photography / Star Wars / awesome / geek / bartending / coffee / drinking / mixology / alcohol / liquor / bartender / cocktail recipe / cats / food / Savoy Cocktail Book / science / Lovecraft / parody / books / Cthulhu / articles / TV / pets / John McCain / promos / Movable Type / cartoons / sci-fi / Canada / Radio Zuckervati / cool / Roger Ebert / system / atheism / comics / reviews / technology / zombies / anime / anonymous / MMO / Star Trek / television / writing / Alinea / animation / Batman / Futurama / Halloween / horror

Twitter Stream

D H McKee's bookshelf: to-read

Sunset and Sawdust
tagged: to-read
The Thicket
tagged: to-read
Hyenas
tagged: to-read

goodreads.com


Close