1. создал новый файл шаблона view_topic_poll_br, объединяющий в общую таблицу шаблоны view_topic_poll_ballot и view_topic_poll_result:
Код: Выделить всё
<tr>
<td class="row2" colspan="2"><br clear="all" />
<table cellspacing="0" cellpadding="4" border="0" align="center">
<tr>
<td align="center" valign="top" colspan="3">
<span class="gen"><b>{POLL_QUESTION}</b></span>
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- начало вывода вариантов -->
<form method="POST" action="{S_POLL_ACTION}"><table cellspacing="0" cellpadding="4" border="0" align="center">
<tr>
<td align="center"><span class="gen"><b>Варианты ответов:</b></span></td>
</tr>
<tr>
<td align="center"><table cellspacing="0" cellpadding="2" border="0">
<!-- BEGIN poll_option -->
<tr>
<td><input type="radio" name="vote_id" value="{poll_option.POLL_OPTION_ID2}" /> </td>
<td><span class="gen">{poll_option.POLL_OPTION_CAPTION2}{poll_option.POLL_OPTION_PERCENT}</span></td>
</tr>
<!-- END poll_option -->
</table></td>
</tr>
<tr>
<td align="center">
<input type="submit" name="submit" value="{L_SUBMIT_VOTE}" class="liteoption" />
</td>
</tr>
</table>{S_HIDDEN_FIELDS}</form>
<!-- конец вывода вариантов -->
</td>
<td width="100">
</td>
<td align="center" valign="top">
<!-- начало вывода статистики -->
<table cellspacing="0" cellpadding="4" border="0" align="center">
<tr>
<td colspan="4" align="center"><span class="gen"><b>Статистика голосования:</b></span></td>
</tr>
<tr>
<td align="center">
<table cellspacing="0" cellpadding="2" border="0">
<!-- BEGIN poll_option -->
<tr>
<td align="right"><span class="gen">{poll_optionb.POLL_OPTION_CAPTION} {poll_option.POLL_OPTION_ID2}</span></td>
<td>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><img src="templates/subSilver/images/vote_lcap.gif" width="4" alt="" height="12" /></td>
<td><img src="{poll_option.POLL_OPTION_IMG}" width="{poll_option.POLL_OPTION_IMG_WIDTH}" height="12" alt="{poll_option.POLL_OPTION_PERCENT}" /></td>
<td><img src="templates/subSilver/images/vote_rcap.gif" width="4" alt="" height="12" /></td>
</tr>
</table>
</td>
<td align="center"><b><span class="gen"> {poll_option.POLL_OPTION_PERCENT} </span></b></td>
<td align="center"><span class="gen">[ {poll_option.POLL_OPTION_RESULT} ]</span></td>
</tr>
<!-- END poll_option -->
</table>
</td>
</tr>
<tr>
<td colspan="4" align="center"><span class="gen"><b>{L_TOTAL_VOTES} : {TOTAL_VOTES}</b></span></td>
</tr>
</table>
<!-- конец вывода статистики -->
</td>
</tr>
</table>
<br clear="all" />
</td>
</tr>
Код: Выделить всё
//вывод формы опроса
$template->set_filenames(array(
'pollbox' => 'viewtopic_poll_br.tpl')
);
for($i = 0; $i < $vote_options; $i++)
{
if ( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
$template->assign_block_vars("poll_option", array(
'POLL_OPTION_ID2' => $vote_info[$i]['vote_option_id'],
'POLL_OPTION_CAPTION2' => $vote_info[$i]['vote_option_text'])
);
}
$template->assign_vars(array(
'L_SUBMIT_VOTE' => $lang['Submit_vote'],
'L_VIEW_RESULTS' => $lang['View_results'],
'U_VIEW_RESULTS' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult"))
);
$s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '" /><input type="hidden" name="mode" value="vote" />';
//конец формы опроса
//вывод результатов опроса
// $template->set_filenames(array('pollbox' => 'viewtopic_poll_br.tpl'));
$vote_results_sum = 0;
for($i = 0; $i < $vote_options; $i++)
{
$vote_results_sum += $vote_info[$i]['vote_result'];
}
$vote_graphic = 0;
$vote_graphic_max = count($images['voting_graphic']);
for($i = 0; $i < $vote_options; $i++)
{
$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
$vote_graphic_length = round($vote_percent * $board_config['vote_graphic_length']);
$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
$vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;
if ( count($orig_word) )
{
$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
}
$template->assign_block_vars("poll_optionb", array(
'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'],
'POLL_OPTION_RESULT' => $vote_info[$i]['vote_result'],
'POLL_OPTION_PERCENT' => sprintf("%.1d%%", ($vote_percent * 100)),
'POLL_OPTION_IMG' => $vote_graphic_img,
'POLL_OPTION_IMG_WIDTH' => $vote_graphic_length)
);
}
$template->assign_vars(array(
'L_TOTAL_VOTES' => $lang['Total_votes'],
'TOTAL_VOTES' => $vote_results_sum)
);
//конец вывода результатов опроса
Подскажите, как это решить?