Wednesday, February 16, 2011

Polling widgets in blogger

If you use blogger adding a poll to your blog is easy. And the way it is implemented allows polls to be associated with the whole blog or just a single post. The same poll can be used in multiple posts while the poll results stay the same.

This can be done by adding the poll gadget to your blog from the blog design mode. While creating the poll take note of the title as you will use this to find the poll in your blogs source code.


Once you have added the poll to your blog you will need to view the source code and find the iframe that contains the poll. The code for the poll will look something like what is displayed below, what you are after is within the iframe tags. The important part is the display number as this identifies your particular poll, in this example it is "1642576544783516899". So you can display the poll in any post as long as you use the same iframe syntax and the id number refers back to the poll as stored in blogger.

<h2 class='title'>The fat cat sat on the </h2>
<div class='widget-content' id='widget-content'>
<iframe allowtransparency='true' frameborder='0' height='180' name='poll-widget1642576544783516899' src='http://www.google.com/reviews/polls/display/1642576544783516899/blogger_template/run_app?txtclr=%23634320&lnkclr=%23e2a059&chrtclr=%23e2a059&font=normal+normal+100%25+Helvetica%2CArial%2CVerdana%2C%27Trebuchet+MS%27%2C+Sans-serif&hideq=true&purl=http%3A%2F%2Fcriticaltechnology.blogspot.com%2F' style='border:none; width:100%;'></iframe>

If you no longer want the poll displayed as a gadget on you blog page (but still within the post) you can delete it from within blogs design mode and the poll will still remain in the blog post. This is due to the id number.