<?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
{foreach from=$questions item=question} <table cellspacing="0" cellpadding="0" style="margin: auto; width: 500px; border: 1px solid #000000;"> <tr> </tr> {foreach from=$answers item=answer} <tr> <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> </tr> {/foreach} <tr> {if empty($question.end)} Trwa {else}{$question.end} {/if} </tr> {/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)
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)
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
