You can include gpoll inside other pages by using SSI. Here is a quick summary of all the SSI options before we get into the details of each option and the troubleshooting section.
To use gpoll as an SSI, you must have Server Side Includes enabled, and put a special code inside your web page. Many options can be passed to gpoll to control the appearance of the poll. The two most important options are "pw", which gives the password allowing the other options to make changes, and "r", which tells gpoll to output in raw mode, without any headers or footers. The "s" is almost always needed as well, as it controls the overall size of the poll.
Further examples can be found below, but a basic SSI would look like this (inside the HTML for the page you are inserting the poll into):
<!--#include virtual="cgi-bin/gpoll?p=4;pw=waldowashere;r=1;s=150;w=20" -->
You will have to figure out the correct path from your web page to the gpoll script. In the example above, gpoll is located in the cgi-bin directory. After the name of the script (i.e. gpoll), put a single question mark, and then each option: put the name, an equal sign, and then the value. Separate multiple options with a semicolon.
Each option will override the current settings for the poll, so you do not need to use all the options, only the ones that you wish to change. Unless specified otherwise, set the option to 0 to turn it off and set it to 1 to turn it on. Here is what each option does:
pw
Password.
This is the most important option, and should match the value of
$GP{SSIPASS} set inside the gpoll
script. If this is not given, or the wrong password is given, all other options
except for "p" and "v" will be ignored.
a: show average
This option will toggle the showing of an average for all the poll answers.
An average will only work on numeric polls, or radio polls whose answers
are numbers only.
b1: first bar image
This option changes the image for the first bar (and every other bar
after that). This should be a number - the number for each image can
be seen by visiting the
Images section
b2: second bar image
This option changes the image for the second bar, and every other bar
after that. (see "b1" above)
This option will toggle the creation of a border around the inner table. A
border will cause each answer to be divided into a separate table cell.
This option will toggle the creation of an outer table border around the entire
poll.
This option toggles the display next to each bar of how many votes
each answer received.
This option toggles the display of when the poll closes. If no closing date
has been set and this option is on, the message
"No closing date has been set" will appear, otherwise the output
will depend on the value of
$GP{SHOWCLOSEDATE}.
This option toggles the display next to each bar of what percentage each answer
is in regards to the total number of votes.
f: full page
This option signals that the full gpoll page should appear
when the form is submitted. Otherwise, an attempt is made
to reload the current page, which is actually a pretty
neat trick. The default is off, so the only value that makes
sense here is a one.
This option toggles whether or not to show a total count of all votes
at the bottom of the poll.
This option will force a poll to be either vertical (0) or
horizontal (1).
This option will force a poll to use graphical images (1) or to
not use images and use colored HTML tables instead (0).
This option toggles the use of shadow effects (the shadow bars) to
achieve a three-dimensional effect. Since SSI polls tend to be small
in order to fit on another page, sometimes the shadow effects
are not needed and don't add much at that small of a size. Shadows
cannot be "turned on", so the only value that makes sense for this
option is zero.
This option toggles the display of other polls in the database. The
list will appear below the poll. It increases the size of the
"page" returned, but mostly in a vertical direction.
m: multi-vote for checkbox polls
This option toggles the display, for checkbox polls only, of how many
people have voted in the poll. Since checkbox polls allow for more
than one answer per person, the number of voters and votes will not
always be the same in these kinds of polls.
o: offset
This option indicates the offset, or the minimum number of pixels
that each bar should have. This is needed so that very small bars
(especially those with a zero value) are still visible. This
number can be set from 1 to a maximum value of "stretch"/10.
p: poll number
This option simply indicates which poll to use. You almost always want
to include this option when doing SSI.
This option specifies which HTML tag to wrap the question in. A setting
of 0 will cause the question to not be displayed at all. Typical
values are "p", h2, or
b. Note that only the name of the tag is needed:
no quotes, no html brackets, and no closing tag.
This option should almost always be turned on. It surpresses the
output of all headers and footers, and only the actual table
containing the poll is output, which is usually what you want when
using SSI.
This option will allow the "view results" link to work, even for
polls that have "view results" turned off. This is a nice way to
ensure that the results are only viewable through your page.
This option changes the image for the first shade bar (and every
other one after that). See
the b1 option for more information.
This option changes the image for the second shade bar. (and every
other one after that). See
the b1 option for more information.
This option sets the maximum size of the bars, in pixels. This is an
excellent way to control the overall size of the poll, and should
almost always be used with SSI. Valid values range from 10 to
2000.
This option specifies what HTML tag to wrap the title in. A setting
of 0 will cause the title to not be displayed at all. If this option
is omitted, the title will not be shown. Typical
values are "p", h2, or
b. Note that only the name of the tag is needed:
no quotes, no html brackets, and no closing tag.
This option toggles the display of the view results link,
which is set by the
$GP{VIEWRESULTS}
variable in gpoll.
V: allow voting
This option allows you to override the "this poll is open
for voting" preference. This is a nice trick, as it allows you
to restrict the viewing of polls to SSI only.
This option specifies the width (or height) of the bars in pixels.
This is basically controlling the smaller dimension of the bar, while
the "stretch" option controls the longer dimension. This option can
be set anywhere from 10 to 200.
This option toggles the display of the standard deviation at the bottom of the poll. Note that the standard deviation will not display unless the average is also displayed.
That's the last option. Why not check out some Further examples?
Here are a few examples of using SSI inside other pages to run the gpoll program:
<!--#include virtual="cgi-bin/gpoll?p=2;r=1;s=200;pw=bizzarro" -->
This example is about as simple as you can get. The password is "bizzarro", and we are viewing poll number 2, in raw mode, with a stretch of 200.
<!--#include virtual="cgi-bin/gpoll?r=1;p=4;pw=lexbaby;s=100;w=10;b1=24;b2=1002;z=0;" -->
In this example, we are viewing poll number four, in raw mode, with a password of "lexbaby." We have set the stretch to 100 pixels, the width to 10 pixels, and changed the images used for bar 1 and bar 2 to #24 and # 1002. Finally, we turn off the standard deviation display.
<!--#include virtual="cgi-bin/gpoll?p=12;B=1;R=1;pw=mxyztplk;r=1;V=1" -->
In this final example, from left to right, we are including poll number 12 on the page, setting the OUTER border on, allowing people to view the results on this page, using a password of 'mxyztplk', setting raw mode, and allowing people to vote in this poll.
For more information about server side includes, see:
http://httpd.apache.org/docs/howto/ssi.html
If the poll is not displaying, here are some things to check:
It may be that the script is not getting parsed, and is being treated as a normal HTML file. If this is the case, then viewing the source of the file will show the SSI commands as normal HTML comments, and the file will appear exactly as it does on the server. Make sure that your httpd.conf file is set up to handle SSI pages, and that you are in the correct directory. Remember that Apache must be restarted after making changes in the httpd.conf file (usually with 'apachectl graceful'). Ensure that the directory is set as parseable. Finally, check that file ends in ".shtml" or that the execute bit is set if you are using the XBitHack option.
If the page does not print all the way, then the script is not running for some reason. Check the error_log for any obvious answers. A common mistake is a typo in the SSI command - the format is very strict, and a misplaced space can cause the program not to run. Make sure that the ExecCGI option is enabled in httpd.conf for this directory. If everything else seems to work, see if you can get a simple SSI command to work. Insert the following into your file:
<!--#echo var="DATE_LOCAL" -->
Then reload the page. The date should appear. If the date does not appear, then the SSI is not being parsed correctly. If it does appear, then there is something wrong with the SSI statement that is calling gpoll. Doublecheck that ExecCGI is set, that you are using the correct syntax, that the gpoll program is working, and that you are using the correct arguments (including the correct password).