Categories > TinyButStrong general >

is it a bug?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: ege
Date: 2008-02-11
Time: 13:27

is it a bug?

hi there:

I'm trying to make some sort of an "embeddable" forum. Here's the code that will look similar to this:

php side:

class Forum{
public $name;
public $category;
public $description;
}

class Category{
public $name;
public $description;
}

$category=new Category();
$category->name='Programming';
$category->description='All your programming talk goes here';

$forum=new Forum();
$forum->name='php forum';
$forum->category=$category;
$forum->description='php talk here';

$forum2=new Forum();
$forum2->name='javascript forum';
$forum2->category=$category;
$forum2->description='js talk here';

$forums=array($forum,$forum2);

$tbs->MergeBlock('forums',$forums);

template side:
<dl>
  <dt><strong>Kategori:[forums.category.name;block=dt;headergrp=category.name]</strong>: <span stye='font-size:10px;'>[forums.category.description;]</span></dt>
  <dd id='whatHappenedToMe'>
    <table id='whereAmI'>
     <tr>
      <td><strong>[forums.name;block=tr]</strong><br /><span style='font-size:10px'>[forums.description]</span></td>
     </tr>
    </table>
  </dd>
</dl>

I'm using the final version of tbs, so using arrays of objects with headergroups should work. However, the opening dd and table tags are missing in the result! That is, after the closing dt, tbs puts the first row (tr) of the table without the opening dd and table. The table and the dd have the closing tags though.

Is it due to something that I am missing, or misusing? Or is it a tbs bug?

Thanks in advance.
ege

By: ege
Date: 2008-02-11
Time: 15:56

Re: is it a bug?

Hm, may be not. I just have read the Golden Rule #4, stating that anything between the two sections of the same block is deleted.

Ok, now, how am I supposed to do what intended do to then?
By: TomH
Date: 2008-02-11
Time: 16:48

Re: is it a bug?

Not sure I understand what you intended output is but...

changing
<td><strong>[forums.name;block=tr]</strong><br /><span style='font-size:10px'>[forums.description]</span></td>
to either...
<td><strong>[forums.name;block=dd]</strong><br /><span style='font-size:10px'>[forums.description]</span></td>
or...
<td><strong>[forums.name;block=table]</strong><br /><span style='font-size:10px'>[forums.description]</span></td>
does work.

HTH,
TomH
By: TomH
Date: 2008-02-11
Time: 16:57

Re: is it a bug?

Ooops,
Sorry looking more closely, the block=table does not really work.

TomH
By: ege
Date: 2008-02-11
Time: 17:34

Re: is it a bug?

Hi,

Thanks for your interest.

Actually, block=dd doesn't work either. However, I actually found the answer in a response to one of your older posts (forum.php?msg_id=6000#). It took me almost entire day to figure out, so I share it here for future reference :

<dl>
  <dt><strong>Kategori:[pForums.pForumCategory.name;block=dt;headergrp=pForumCategoryId]</strong>: <span stye='font-size:10px;'>[pForums.pForumCategory.description;]</span></dt>
  <dd>
    <table border='1'>[pForums;block=dd;parentgrp=pForumCategoryId]
     <tr>
      <td><span style='font-size:10px'>[pForums.description]</span></td>
     </tr>
    </table>
  </dd>
</dl>

The key is to use the parentgrp that allows you to define normal sections in the block.
By: Skrol29
Date: 2008-02-12
Time: 21:35

Re: is it a bug?

Hi Ege,

You could have the same result using your first template and by replacing "headergrp" with "parentgrp".

But I don't understand why you need to group forums items by names or by ids because it seems that all items are in a different group.
By: ege
Date: 2008-02-13
Time: 10:46

Re: is it a bug?

Hi Skrol29,

First, for some reason I posted a non working example, I'm poting the really working version now:

<dl>
  <dt><strong>Kategori:[pForums.pForumCategory.name;block=dt;headergrp=pForumCategoryId]</strong>:</dt>
  <dd>[pForums;block=dd;parentgrp=pForumCategoryId;]
    <table border='1'>
     <tr>
      <td>[pForums.name;block=tr]<br /><span style='font-size:10px'>[pForums.description]</td><td>some other info</td>
     </tr>
    </table>
  </dd>
</dl>

Well I couldn't figure how I could make it simpler than that.

What I want to achieve is that a structure where there can be many forum items, each forum belonging to only one category, very similar to phpbb stuff. As you can see from the php code in the openin post, 2 forums are under the same category whose name property is "Programming".

I just want to put the category title in dt, and use dd as the forums container of that category, where each forum's title and some additional info is displayed as rows of a table inside dd. I know I could have achived the same result with different mark up but I just wanted to try to see if I can do the same.

So I want the dt part to appear only when categoryId changes,
I want the dd part to appear only when categoryId changes as well,
I want the tr part to appear everytime the forum changes.

So if there is a way to group dt and dd and repeat them together every time category changes that would just solve it. But there is no container that holds both (other than dl which I don't want to repeat) so I had to write tbs markup for both of them. Any solutions to this?