Plugin: Install and Configure Poll Position


Install

To use Poll Position, you’ll first need to get the files in place on your server.

  1. Get Poll Position by downloading (or purchase Poll Position: Champion) and extract the archive.
  2. Upload the plugins/ and mt-static/ folders to your Movable Type installation.
  3. In plugins/PollPosition/ find vote.cgi and set its permissions to 0755.
  4. In mt-static/plugins/PollPosition/, be sure the cache/ folder has sufficient permissions. 0755 should be fine for most, though 0777 may be required. (If you’re using Google Charts to display poll results, the resulting image is cached here.)
  5. Poll Position makes use of the StaticFilePath configuration directive. You’ll need to edit mt-config.cgi to add this. You may have entered this directive when installing Movable Type 4.x, though older installations will almost definitely not have it set. Just take a moment to set/verify it.

Configure

While Poll Position is now installed, there are still a few steps you need to take to get it working: adjust plugin settings and create required templates.

Modify Plugin Settings

Blog-level settings control the poll results. Within a blog, visit the Tools menu and choose Plugins, then find Poll Position and view its settings. Poll Position can display poll results as a bar chart using Google Charts; Poll Position: Champion can display poll results as a Google Charts bar chart, or use a template you create to display results.

  • Poll Position: Champion only: Use Google Charts is checked by default; uncheck to use your own template and return HTML. A sample “Poll Position Results” global template is created (if needed) where you can craft your HTML and MT markup. Read more about customizing the results display.
  • The Chart Size option is where you can specify the width or your Google Charts bar chart image. The height of the chart is automatically calculated by Poll Position based on the number of response choices you’ve created and the bar chart height and spacing.
  • The thickness of the bar generated by Google Charts can be set using the Chart Bar Thickness option. This option is specified in pixels, and only a numeral needs to be entered here.
  • Similar to the Chart Bar Thickness option, the Space Between Bars value is a pixel number and only a numeral is entered. As the name says, this controls the space between each bar result.
  • Surely, you’ll want to control the colors used in your poll’s result. The Chart Colors option is where you do this. You have the option to specify both the foreground (chart bar) and background colors. Specify these as six-character hex values, without the leading pound sign. The background also supports transparency, in the way of a 2-character hex value: ff is fully transparent and 00 is fully opaque. Note that any color used with the ff transparency will be fully transparent—ffffffff (transparent white) will appear the same as 000000ff (transparent black).

Be sure to save your options after setting them.

Add Required Templates

There are a few new templates you’ll need to add—as well as modifications to your existing templates that need to be made—to allow visitors to interact with polls on your site. In the folder plugins/PollPosition/default_templates/ you’ll find the required templates.

  • pollposition.js.mtmlis the Javascript that lets Poll Position do it’s thing. Create a new index template and copy-paste this code into it. Be sure to name the template and fill the Output File field before saving and publishing (I called mine pollposition.js).
  • Poll Position uses the Yahoo! User Interface Library to do the hard work. YUI needs to be included to work; a Template Module is used to do this. Create a new template module and copy-paste the contents of yui_javascript.mtml into it. Be sure to name the Template Module before saving (I used YUI Javascript).

Next you’ll need to include those templates in your published pages. The following needs to be included in between the <head> ... </head> section of any page you want to display a poll on. If you’re using the default MT4 templates you can simply modify the “Header” Template Module.

Of course, you’ll want to be sure that the module name matches the module you created, and that the published Javascript filename matches the template you created. Save and republish any affected templates.

Add Template Tags

Next, you’ll need to use the Poll Position template tags to add a poll to your site. The easiest way to do this is with the CompletePoll tag, which creates a complete and unique poll form for you.

If you’re using Poll Position: Champion you can also use the provided template tags to create your own poll form as well as poll results. Refer to the folder plugins/PollPosition/default_templates/; poll.mtml contains an example form and poll_position_results.mtml contains an example results display.

A great way to include a poll on your site is this: create a new Index Template named “Poll Position” and dynamically include it on your published site (in the sidebar, for example, with PHP). Place your <CompletePoll> or <Polls> ... </Polls> code in this Index Template. Whenever you save a poll, this template will be rebuilt!

Poll Custom Field Type

customfield.png entry-customfield.png

Poll Position: Champion includes a “Poll” custom field type. This can be used to allow authors to select a poll to include in an entry, for example. Create a system- or blog-level Custom Field and select the “Poll” type to create the field. The template tag created for this field will return a poll ID, which you can use with the IfPollIncluded template tag to output a poll. This feature requires the Movable Type Commercial.pack.

For a more detailed overview of Poll Position refer to Use.