Go to the previous topic.    Go to the next topic.

Displaying Results

To Display the Results of Your Poll, method 1:

Create an HTML document that contains your content and has a .shtml extension. This extension tells the web server to parse includes and display the results of the include.

In this example, "results.shtml" will be the example SHTML document.

<html>
<body>
<div align="center">
<!--#include virtual="/cgi-bin/poll.cgi?poll_id=yesno&ssi=1" -->
</div>
</body>
</html>

The above example will display the poll identified by poll_id. In this case, it is our aforementioned yesno poll.

To display results via SSI (Server Side Includes), you must also give the script the parameter ssi=1 or ssi=yes, as shown above.

The default color of the results bars is black. This can be changed by also passing in the "bar_color=COLOR" parameter. For example:

<!--#include virtual="/cgi-bin/poll.cgi?poll_id=yesno&bar_color=yellow&ssi=1" -->

The available colors are as follows:

<!--#include virtual="/cgi-bin/poll.cgi?poll_id=yesno&bar_color=chartruse&ssi=1" -->

To Display the Results of Your Poll, method 2:

If you do not wish to use SSI, you can make a link directly to the current poll. Simply use this format:

<a href="/cgi-bin/poll.cgi?poll_id=yesno"> View Poll Results </a>

Again, you can pass in the bar color, and the css style.

<a href="/cgi-bin/poll.cgi?poll_id=yesno&bar_color=orange&css=poll_yellow.css"> View Poll Results </a>

When displaying the results this way, 25 random past polls will also be generated in a menu on the left-hand side of the page.

To Display Past Polls:

You can also include a list to past polls. Use the same method of including the "include" line, but use the following variables:

<!--#include virtual="/cgi-bin/poll.cgi?past_polls=1" -->

The past_polls variable will be given in this case, with a value of "1" or "yes".

This will link to the built-in function of displaying the poll results. With just the above link, the default colors format will be used. You can, however, give extra options to further customize the displayed results.

<!--#include virtual="/cgi-bin/poll.cgi?past_polls=1&bar_color=red" -->

Use the above include to link to results that display a red bar.

Note: For any SSI included poll data, you will need to do all the formatting within the page. Simply the raw html will be displayed with the includes, so putting them within a table or div would be a lot prettier.