Integrate Dyn Vote polls into your website




To integrate the poll into your website with the default layout via the Javascript, just add the below code to your website.
<!DOCTYPE html>
<meta charset="UTF-8">
<div id="dynvote_POLL_ID" style="border:1px solid #dbc9d2;display:none"></div>
<script>
var url = 'http://www.dynvote.com'+'/api/public/?id='+'POLL_ID'+'&key='+'NON_EXCLUSIVE_KEY';
var s = document.createElement("script");
s.type = "text/javascript";
s.src = url || null;
document.getElementsByTagName("head")[0].appendChild(s);
</script>

Your integrated poll will look like below. The width will extend to fit the width of the parent container area.

If you want to add header and customize the color, scale size, fonts & more CSS properties for the poll, then use the below code and edit the value of the parameters in bold style to suite your website layout/theme.
<!DOCTYPE html>
<meta charset="UTF-8">
<div id="dynvote_POLL_ID" style="border:1px solid #c8c8c8;display:none"></div>
<script>
var id='POLL_ID',
key='NON_EXCLUSIVE_KEY',
header=1,
header_text='Polling',
header_textalign='left',
header_padding='9px 8px 9px 11px',
header_fontfamily='tahoma',
header_fontsize='9pt',
header_fontcolor='#cc0000',
header_background='#e0e0e0',
header_fontweight='bold',
body_scalesize='normal',
body_colorset='blue',
body_background='#FDFAEE',
body_fontfamily='tahoma';
var url = 'http://www.dynvote.com'+'/api/public/?id='+'POLL_ID'+'&key='+'NON_EXCLUSIVE_KEY'+'&&header='+header+'&header_text='+header_text+'&header_textalign='+header_textalign+'&header_padding='+header_padding+'&header_fontfamily='+header_fontfamily+'&header_fontsize='+header_fontsize+'&header_fontcolor='+encodeURIComponent(header_fontcolor)+'&header_background='+encodeURIComponent(header_background)+'&header_fontweight='+header_fontweight+'&body_scalesize='+body_scalesize+'&body_colorset='+body_colorset+'&body_background='+encodeURIComponent(body_background)+'&body_fontfamily='+body_fontfamily;
var s = document.createElement("script");
s.type = "text/javascript";
s.src = url || null;
document.getElementsByTagName("head")[0].appendChild(s);
</script>

Your customized poll will look like below:


The Header parameters & their corresponding values
a. header
If it is set to 1, the header will be enabled. If you don't include it or if it is set to any value other than 1, it will be hidden
The URL looks like: '...&header=1&...' or '...&header=0&...'.
b. header_text
The text of the header
The parameter in the URL looks like: '...&header_text=Polling&...' or '...&header_text=Voting&...', etc.
The default value is Voting
c. header_textalign
The alignment of the text in the header
The available values are: left, right & center . The parameter in the URL looks like: '...&header_textalign=center&...', '...&header_textalign=right&...', or '...&header_textalign=left&...'.
The default value is left
d. header_padding
To control the padding added to the header text
The parameter in the URL looks like: '...&header_padding='.encoding_function('9px 8px 9px 10px').'&...' or '...&header_padding='.encoding_function('1.2em').'&...', etc.
The default value is 7px 7px 7px 10px
e. header_fontfamily
To have different fonts for the poll
The parameter in the URL looks like: '...&header_fontfamily=tahoma&...' or '...&header_fontfamily=andalus&...', etc.
The default value is tahoma,sans-serif,helvetica
f. header_fontsize
To have different sizes for the header text
The parameter in the URL looks like: '...&header_fontsize=13pt&...' or '...&header_fontsize=1.3em&...', etc.
The default value is 10pt
g. header_fontcolor
To color the font with different colors
The parameter in the URL looks like: '...&header_fontcolor=red&...' or '...&header_fontcolor='.encoding_function('#c0c0c0').'&...', etc.
The default value is #666
h. header_background
To adjust the background color of the header
The parameter in the URL looks like: '...&header_background=red&...' or '...&header_background='.encoding_function('#c0c0c0').'&...', etc.
The default value is #f0f0f0
i. header_fontweight
To adjust the weight of the font
The parameter in the URL looks like: '...&header_fontweight=bold&...' or '...&header_fontweight=normal&...' or '...&header_fontweight=900&...', etc.
The default value is bold

The Body parameters & their corresponding values
a. body_scalesize
Two scales are provided: small and large
The URL looks like: '...&body_scalesize=small&...' or '...&body_scalesize=big&...'.
The default value is large
b. body_colorset
To provide a consistent color set for the poll body. Available color sets: red, grey, blue, green, orange and the default one.
The parameter in the URL looks like: '...&body_colorset=red&...' or '...&body_colorset=grey&...' or '...&body_colorset=blue&...', etc.
The default value is the original poll default color. By default, it will be applied if you don't include this parameter.
c. body_background
To add a background color for the poll body
The parameter in the URL looks like: '...&body_background=gold&...' or '...&body_background='.encoding_function('#f0f0f0').'&...', etc.
The default value is white
d. body_fontfamily
To have different fonts for the poll body
The parameter in the URL looks like: '...&body_fontfamily=tahoma&...' or '...&body_fontfamily=andalus&...', etc.
The default value is tahoma,sans-serif,helvetica

Note 1: If you don't include a particular parameter, then a default value will be applied. By default, the poll header is not included.

Note 2: The text direction of the question will automatically change according to the language text direction, if you wish to change it manually, just add the CSS property text-align to the parent container, like: style="...;text-align:center;...", it will change the direction of the question only.


Private Integration via PHP
When you integrate your poll via PHP, nobody can see the secure key when viewing the source code of your website and hence, you are the only one who can integrate it. To proceed, include the below once:
<!DOCTYPE html>
<?php error_reporting(E_ERROR | E_PARSE) ?>
<?php header("Content-type: text/html; charset=UTF-8") ?>
<?php foreach (file('http://www.dynvote.com/api/pre_includes.php') as $o) echo $o ?>
Then add as much polls as you need by including the line below which contains the poll ID and the poll secret key for each poll. Bear in mind that the poll at this point is basic without customization for the header and the body. You can customize the poll by adding the parameters of the poll header and the poll body as described previously.
<div style="border:1px solid #dbc9d2">
<?php
foreach (file('http://www.dynvote.com'.'/api/private/?t='.time().'&id=POLL_ID&key=EXCLUSIVE_KEY') as $o) echo $o;
?>
</div>

If you want to add header and customize your poll similar to the customization of the Javascript integration above, then add the below code to your website and edit the value of the parameters in bold style to suite your website layout/theme. The values of the parameters are similar to the aforsaid values above.
<div style="border:1px solid #c8c8c8">
<?php
$id='POLL_ID';
$key='EXCLUSIVE_KEY';
$header=1;
$header_text='Polling';
$header_textalign='left';
$header_padding='9px 8px 9px 11px';
$header_fontfamily='tahoma';
$header_fontsize='9pt';
$header_fontcolor='#cc0000';
$header_background='#e0e0e0';
$header_fontweight='bold';
$body_scalesize='normal';
$body_colorset='blue';
$body_background='#FDFAEE';
$body_fontfamily='tahoma';
foreach (file('http://www.dynvote.com'.'/api/private/?t='.time().'&id='.$id.'&key='.$key.'&header='.$header.'&header_text='.urlencode($header_text).'&header_textalign='.$header_textalign.'&header_padding='.urlencode($header_padding).'&header_fontfamily='.$header_fontfamily.'&header_fontsize='.$header_fontsize.'&header_fontcolor='.urlencode($header_fontcolor).'&header_background='.urlencode($header_background).'&header_fontweight='.$header_fontweight.'&body_scalesize='.$body_scalesize.'&body_colorset='.$body_colorset.'&body_background='.urlencode($body_background).'&body_fontfamily='.$body_fontfamily) as $o) echo $o;
?>
</div>