Categories > TinyButStrong general >

Definition List problem

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: gustaf
Date: 2007-07-06
Time: 12:21

Definition List problem

I have the following array:

Array
(
    [0] => Array
        (
            [question] => Question1?
            [answer] => Answer1!
        )

    [1] => Array
        (
            [question] => Question2?
            [answer] => Answer2!
        )

    [2] => Array
        (
            [question] => Question3?
            [answer] => Answer3!
        )
)

What shall I do to get the following output with TBS?:

<dl>
     <dt>Question1?</dt>
     <dd>Answer1!</dd>

     <dt>Question2?</dt>
     <dd>Answer2!</dd>

     <dt>Question3?</dt>
     <dd>Answer3!</dd>
</dl>

I hope I don't have missed something obvious but I just can't get it right.

Thanks / Gustaf
By: TomH
Date: 2007-07-06
Time: 15:05

Re: Definition List problem

Gustaf,

Please show us your php and template code so we can see what you've got so far
By: gustaf
Date: 2007-07-07
Time: 02:06

Re: Definition List problem

Actually I don't know how to do. The only thing I can come up with it:

PHP:
$faq[] = array("question" => "Question1?", "answer" => "Answer1!");
$faq[] = array("question" => "Question2?", "answer" => "Answer2!");
$faq[] = array("question" => "Question3?", "answer" => "Answer3!");
$TBS->MergeBlock('faq',$faq);

and (x)HTML:
<dl>
<dt>[faq.question;block=???]</dt>
<dd>[faq.question;block=???]</dd>
</dl>

Sure I can nest <dt>- and <dd>-tags in some homemade tag (instead of ???) but then I won't have semantically correct xhtml.

Any ideas?
By: TomH
Date: 2007-07-07
Time: 13:57

Re: Definition List problem

You're almost there, try simply
<dl>
<dt>[faq.question;block=dl]</dt>
<dd>[faq.answer]</dd>
</dl>
And, you only need the "block= " once inside any block.

Hope that helps,
TomH
By: TomH
Date: 2007-07-07
Time: 14:12

Re: Definition List problem

Sorry, I didn'Tom read you thoroughly :(

You are right, I think you need a dummy tag.

But XHTML accepts any tag set doesn't it - after all isn't that the purpose of the semantic rules?

<dl>
<qa>
<dt>[faq.question;block=qa]</dt>
<dd>[faq.answer]</dd>
</qa>
</dl>