Categories > TinyButStrong general >

grouping sections custom

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: TomH
Date: 2006-07-22
Time: 15:17

grouping sections custom

I am trying to slightly alter the TBS grouping example...just to place the countries side-by-side in two cols. I have tried to make the least possible changes to the TBS example in order to make clear what I change to get the effect.

The two columns are grouped correctly, the city is placed correctly BUT does not repeat correctly inside the country group.
The winner and score render in correct location BUT also does not repeat correctly inside the city group.

I am using exactly the same PHP (tbs_us_examples_grouping.php)  for this test and here is my template file
tbs_us_examples_grouping.htm
<table width="100%" border="1" cellspacing="2" cellpadding="8" align="center" bgcolor="#D0D0D0">
  <tr>
    <td bgcolor="#FFD2FF">
     [blk_res.country;block=td;headergrp=country]
        <table bgcolor="#CFE7CF" width="100%" border="1" cellspacing="0" cellpadding="4">
        <tr>
          <td colspan="4" bgcolor="#CFE7CF" class="title-section"> [blk_res.country;block=tr;]</td>
        </tr>
        <tr>
          <td width="20" bgcolor="#FFF5D2">&#8226;</td>
          <td colspan="3" bgcolor="#FFF5D2"><u>[blk_res.city;block=tr;headergrp=city]</u></td>
        </tr>
        <tr class="text-mini">
          <td>&nbsp;</td>
          <td bgcolor="#F0F0F0">&nbsp;</td>
          <td bgcolor="#F0F0F0"><strong><em>Nom</em></strong></td>
          <td bgcolor="#F0F0F0"><strong><em>Score</em></strong></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td width="20" bgcolor="#F0F0F0">&deg;</td>
          <td width="100" bgcolor="#F0F0F0">[blk_res.winner;block=tr]</td>
          <td bgcolor="#F0F0F0">[blk_res.score;block=tr]</td>
        </tr>
        <tr>
          <td bgcolor="#FFFFDF">&rarr; </td>
          <td colspan="3" bgcolor="#FFFFDF"><span class="text-mini">[blk_res.city;block=tr;footergrp=city]</span></td>
        </tr>
      </table>

<span class="text-mini">[blk_res.country;block=((td));footergrp=country]</span>

</td>
  </tr>
</table>

</body>
</html>

Can anyone see what is stopping the city and winner from repeating in the blocks??

Thank you,
By: Skrol29
Date: 2006-07-24
Time: 10:11

Re: grouping sections custom

Hi Tom,

The following should wok better. (some comments after the block)
<table width="100%" border="1" cellspacing="2" cellpadding="8" align="center" bgcolor="#D0D0D0">
  <tr>
    <td bgcolor="#FFD2FF">
  [blk_res.country;block=td;parentgrp=country]
      <table bgcolor="#CFE7CF" width="100%" border="1" cellspacing="0" cellpadding="4">
        <tr>
          <td width="20" bgcolor="#FFF5D2">&#8226;</td>
          <td colspan="3" bgcolor="#FFF5D2"><u>[blk_res.city;block=tr+tr;headergrp=city]</u></td>
        </tr>
        <tr class="text-mini">
          <td bgcolor="#FFF5D2">&nbsp;</td>
          <td bgcolor="#F0F0F0">&nbsp;</td>
          <td bgcolor="#F0F0F0"><strong><em>Nom</em></strong></td>
          <td bgcolor="#F0F0F0"><strong><em>Score</em></strong></td>
        </tr>
        <tr>
          <td bgcolor="#FFF5D2">&nbsp;</td>
          <td width="20" bgcolor="#F0F0F0">&deg;</td>
          <td width="100" bgcolor="#F0F0F0">[blk_res.winner;block=tr]</td>
          <td bgcolor="#F0F0F0">[blk_res.score;block=tr]</td>
        </tr>
        <tr>
          <td bgcolor="#FFFFDF">&rarr; </td>
          <td colspan="3" bgcolor="#FFFFDF"><span class="text-mini">[blk_res.city;block=tr;footergrp=city]</span></td>
        </tr>
      </table>

</td>
  </tr>
</table>

My comments about your snippet:
a) The TBS tag with "footergrp=country" is considered as a simple TBS field. Parameters "block=..." and "footergrp=..." are ignored because the tag is contained itself into the block previously defined by another tag.
b) In the first tag, paramater "headergrp" is not the proper parameter to use. Since the block contains other sections of the same block, it should be "parentgrp=country" in order to work. Parameter "parentgrp" is the only parameter which enables you to have a sections into other sections of the same block.
c) Tag [blk_res.country;block=tr;] should be deleted, it use a record to be displayed.

By: TomH
Date: 2006-07-24
Time: 15:32

Re: grouping sections custom

That's brilliant, thank you for the nice explanation.

I was not understanding the relationship of parentgrp from the example.

I see the little gem "tr+tr"  in your code... "I see, says the blind man"

A very thankful,
TomH