Documentation

ShowVote

ShowVote(
 VOTE_ID, [
 template]
);

The function emits the HTML code of the poll form.

Parameters

ParameterDescription
VOTE_IDPoll ID.
template Name of the template file used to display the poll. If omitted, the template specified in the poll settings is used instead.

Example

The following is the example of the file vote.php used in the public section.

<?
// Display a poll form by its ID
require_once(
    $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
if (CModule::IncludeModule("vote") && $VOTING_OK=="Y") 
{
    $VOTE_DIR = COption::GetOptionString("vote", "VOTE_DIR", "");
    $z = CLang::GetByID(LANG);
    $zr = $z->Fetch();
    $LANG_DIR = $zr["DIR"];
    $LANG_DIR = TrimExAll($LANG_DIR,"/");
    $VOTE_DIR = TrimExAll($VOTE_DIR,"/");
    LocalRedirect(
        "/".$LANG_DIR."/".$VOTE_DIR."/vote_result.php?VOTE_ID=".$PUBLIC_VOTE_ID."&VOTING_OK=Y");
}

if (strlen($APPLICATION->GetTitle())<=0)
    $APPLICATION->SetTitle(GetMessage("VOTE_VOTING_TITLE"));

require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_after.php");
?><?
if (CModule::IncludeModule("vote"))
    ShowVote($VOTE_ID);

require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog.php");
?>
© «Bitrix24», 2001-2024
Up