Доброго времени суток!
Есть задача: вывести опрос в теле новости. Т.е. создается новость, в ней идет какой-то текст и под ним должно выводится голосование. В админке через справочники я добавил возможность выбирать из списка опрос. Но какой командой заставить выводить этот опрос только в этой новости, а не во всех?
Пробовал использовать
%data getProperty(%id%, 'opros', 'opros')%
Но что-то не получается. Или я неправильно использую шаблон? Копировал его из каталога: /tpls/vote/default.tpl в /tpls/data/
Чего не хватает в вашем вопросе, так это описания что в итоге вы имеете при выводе нужной новости и остальных? и что у вас в шаблоне "opros"
Да, забыл дописать. В итоге в новости ничего не выводится, пустое место. А в остальных новостях и не должно. Шаблон "opros.tpl" имеет следующий код:
<?php
$FORMS = Array();
$FORMS['vote_block'] = <<<END
<div><img src="/images/redfox/00.gif" width="1" height="20" alt="" border="0" /></div>
<table cellpadding="0" cellspacing="0" border="0" width="400">
<tr>
<td><img src="/images/redfox/00.gif" width="10" height="1" alt="" border="0" /></td>
<td><img src="/images/redfox/00.gif" width="100" height="1" alt="" border="0" /></td>
</tr>
<tr valign="top">
<td class="bgBox2TopL"><img src="/images/redfox/00.gif" width="1" height="10" alt="" border="0" /></td>
<td class="bgBox2TopR"><img src="/images/redfox/00.gif" width="1" height="1" alt="" border="0" /></td>
</tr>
<tr>
<td colspan="2" class="bgBox1">
<div class="bgBox2Margin">
<form method="post" name="postForm_%id%">
<div class="voteTitle deep"><b>%text%</b></div>
<div style="margin:10px 0px 5px 10px;">
<table cellpadding="0" cellspacing="0" border="0" width="355" >
<tr>
<td><img src="/images/redfox/00.gif" width="25" height="1" alt="" border="0" /></td>
<td><img src="/images/redfox/00.gif" width="330" height="1" alt="" border="0" /></td>
</tr>
%lines%
<tr><td colspan="2" class="bgDotGrey3"><img src="/images/redfox/00.gif" width="1" height="1" alt="" border="0" /></td></tr>
</table>
<div>%submit%</div>
</div>
</form>
</div>
</td>
</tr>
<tr>
<td class="bgBox1BotL"><img src="/images/redfox/00.gif" width="1" height="10" alt="" border="0" /></td>
<td class="bgBox1BotR"><img src="/images/redfox/00.gif" width="1" height="1" alt="" border="0" /></td>
</tr>
</table>
<div><img src="/images/redfox/00.gif" width="1" height="20" alt="" border="0" /></div>
END;
$FORMS['vote_block_line'] = <<<END
<tr><td colspan="2" class="bgDotGrey3"><img src="/images/redfox/00.gif" width="1" height="1" alt="" border="0" /></td></tr>
<tr>
<td><input type="radio" name="vote_results" value="%item_id%" /></td>
<td><div class="voteLine">%item_name%</div></td>
</tr>
END;
$FORMS['vote_block_submit'] = <<<END
<div><img src="/images/redfox/00.gif" width="1" height="12" alt="" border="0" /></div>
<a href="/" onclick="javascript: cms_vote_postDo('postForm_%id%', 'vote_results', '%vote_not_selected%'); return false;"><img src="/images/redfox/buttons/votes_3d.gif" height="22" alt="Голосовать" border="0" /></a>
END;
$FORMS['result_block'] = <<<END
<div><img src="/images/redfox/00.gif" width="1" height="20" alt="" border="0" /></div>
<table cellpadding="0" cellspacing="0" border="0" width="400">
<tr>
<td><img src="/images/redfox/00.gif" width="10" height="1" alt="" border="0" /></td>
<td><img src="/images/redfox/00.gif" width="100" height="1" alt="" border="0" /></td>
</tr>
<tr valign="top">
<td class="bgBox2TopL"><img src="/images/redfox/00.gif" width="1" height="10" alt="" border="0" /></td>
<td class="bgBox2TopR"><img src="/images/redfox/00.gif" width="1" height="1" alt="" border="0" /></td>
</tr>
<tr>
<td colspan="2" class="bgBox1">
<div class="bgBox2Margin">
<div class="voteTitle deep"><b>%question%</b></div>
<div style="margin:10px 0px 5px 10px;">
<table cellpadding="0" cellspacing="0" border="0" width="355" >
<tr>
<td><img src="/images/redfox/00.gif" width="200" height="1" alt="" border="0" /></td>
<td><img src="/images/redfox/00.gif" width="155" height="1" alt="" border="0" /></td>
</tr>
%lines%
<tr><td colspan="2" class="bgDotGrey3"><img src="/images/redfox/00.gif" width="1" height="1" alt="" border="0" /></td></tr>
</table>
<div><img src="/images/redfox/00.gif" width="1" height="10" alt="" border="0" /></div>
<div><b>Всего голосов: %total_posts%</b></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="bgBox1BotL"><img src="/images/redfox/00.gif" width="1" height="10" alt="" border="0" /></td>
<td class="bgBox1BotR"><img src="/images/redfox/00.gif" width="1" height="1" alt="" border="0" /></td>
</tr>
</table>
<div><img src="/images/redfox/00.gif" width="1" height="20" alt="" border="0" /></div>
END;
$FORMS['result_block_line'] = <<<END
<tr><td colspan="2" class="bgDotGrey3"><img src="/images/redfox/00.gif" width="1" height="1" alt="" border="0" /></td></tr>
<tr><td colspan="2"><img src="/images/redfox/00.gif" width="1" height="5" alt="" border="0" /></td></tr>
<tr>
<td>%item_name%(%item_result%)</td>
<td width="30px"><div class="voteBarLine"><div class="voteBarProg" style="width:%item_result_proc%%"></div></div></td>
</tr>
<tr><td colspan="2"><img src="/images/redfox/00.gif" width="1" height="5" alt="" border="0" /></td></tr>
END;
$FORMS['js_block'] = <<<END
window.location.reload();
END;
?>