Categories > TinyButStrong general >

how to display block multiple times

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Zeljko Dakic
Date: 2005-10-28
Time: 18:22

how to display block multiple times

Hi,

so how do I display block multiple times without multiple definitions.

Here is the issue. I have a list of questions that have the same choices, I need to display those choices for each question.

So I have database table questions, that lists questions and choices table that should display choices for those questions (it is more complex than that but this is the essence).

So far I was able to do everything with TBS, I am sure there is a way for this as well.

Thank you all,

Zeljko Dakic

By: Skrol29
Date: 2005-10-28
Time: 18:35

Re: how to display block multiple times

If all Questions have the same set of Answers, then you can embed a [answer] block into a [question] block. Merge [answer] first, then [question]

Example:
<div>
  Q: [question.text;block=div]
  <div>
    <input type="radio"
      name="q_[question.id]"
      value="[answer.value]"> [answer.text;block=div]
  </div>
</div>

PHP:
$TBS->MergeBlock('answer',$conn,'SELECT ...');
$TBS->MergeBlock('question',$conn,'SELECT ...');

If Questions and Answers are linked, then use sub-blocks with dynamic query. (see manual and examples)
By: Zeljko Dakic
Date: 2005-10-28
Time: 18:43

Re: how to display block multiple times

Maybe I didn't get the order right. thanks for the answer I will try this.

Zeljko