Documentation

ShowCurrentVote

ShowCurrentVote(
 GROUP_SYMBOLIC_NAME, [
 lid]
);

The function emits the HTML code of the current poll of the specified channel.

Parameters

ParameterDescription
GROUP_SYMBOLIC_NAMESymbolic name of the channel.
lid Site ID. By default, the current site ID is used.

Example

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

<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
// Display a form with the current poll of the channel.
// Then redirect to a page with the results of the poll
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")) ShowCurrentVote("ANKETA");
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog.php");
?>
© «Bitrix24», 2001-2024