Takim o kodem
<?php
$poll -> db_query = 'SELECT * FROM $tbl_poll';
$poll -> GetQuestion();
$smarty -> assign('questions', $poll -> row);
foreach ($poll -> row as $question){
$poll = new poll;
$poll -> GetAnswers($question['id']);
$smarty -> assign('answers', $poll -> row);
$poll = new poll;
$question_id = $question['id'];
$poll -> AllVoices($question_id);
$smarty -> assign('all_voices', $poll -> all);
}
$smarty -> display("$theme/index.tpl");
?>
pobieram i wysyłam do pliku index.tpl pytanie i odpowiedzi do każdej sondy w pliku poll.tpl (includowany w index.tpl) dane wyświetlam w ten sposób
<p class="text_03"><b>Archiwum Ankiet:
</b></p> {foreach from=$questions item=question}
<table cellspacing="0" cellpadding="0" style="margin: auto; width: 500px; border: 1px solid #000000;"> <td colspan="2" class="text_01" style="background-color: {$color_1}"> <b>{$question.question}
</b></td> {foreach from=$answers item=answer}
<td colspan="2"class="text_01" style="background-color: {$color_2}">{$answer.answer}
<img src="templates/Blue/images/poll.gif" style="height: 10px; width: {math equation="voice * 100 / voices" voice=$answer.votes voices=$all_voices format="%.0f"}px; border: 1px solid #000000"> {math equation="voice * 100 / voices" voice=$answer.votes voices=$all_voices format="%.2f"}%
</td> {/foreach}
<td class="text_01" style="background-color: {$color_1}">Rozpoczęta:
<b>{$question.started}
</b></td> <td class="text_02" style="background-color: {$color_1}">Zakończona:
<b> {if empty($question.end)} Trwa
{else}{$question.end}
{/if}
{/foreach}
I wszystko by było w porządku gdyby nie to, że pokazuje to w ten sposób
Cytat
Pytanie 1
Odpowiedź a (dla pyt 1)
Odpowiedź b (dla pyt 1)
Pytanie 2
Odpowiedź a (dla pyt 1)
Odpowiedź b (dla pyt 1)
a nie tak
Cytat
Pytanie 1
Odpowiedź a (dla pyt 1)
Odpowiedź b (dla pyt 1)
Pytanie 2
Odpowiedź a (dla pyt 2)
Odpowiedź b (dla pyt 2)
Pytanie brzmi gdzie jest błąd (IMG:
http://forum.php.pl/style_emoticons/default/blinksmiley.gif)