Categories > TinyButStrong general >

Can't use 'bmagnet' with 'nodata'

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Eugef
Date: 2006-10-06
Time: 15:13

Can't use 'bmagnet' with 'nodata'

I have the template:
<table>
  <tr>
    <td>
      <table>
        <tr align="center">
          <td>Name</td>
          <td>Count</td>
        </tr>
        <tr>
          <td>[product.name;block=tr;bmagnet=table]</td>
          <td[product.count]</td>
        </tr>
      </table>
      <p>[product;block=p;nodata]No product</p>
    </td>
  </tr>
</table>
I want to show a table with a header when products exists and text "No products" when there is no products.

But I&#1072; there is no products i get a bad html:
<table>
  <tr>
    <td>
      <table>
        <tr align="center">
          <td>Name</td>
          <td>Count</td>
        </tr>
        <p>No products</p>

    </td>
  </tr>
</table>
Without 'nodata' it works correct, but with 'nodata' 'bmagnet' doesn't delete the whole table!
Help me!
Whereis the mistake?
By: Skrol29
Date: 2006-10-06
Time: 15:46

Re: Can't use 'bmagnet' with 'nodata'

Hello,

TBS assumes that your block "product" has 2 sections : one normal section and one nodata section. The entire block starts from <tr> and goes up to </p>.
The tag </table> is placed between two sections and so it is deleted.
That is how TBS sees your block definition.

You can do what you simply by using an [onshow] block instead of the nodata section. Exemple:
<p>[onshow;block=p;when [product.*]=0]No product</p>



By: Eugef
Date: 2006-10-06
Time: 16:06

Re: Can't use 'bmagnet' with 'nodata'

I replace the
<p>[product;block=p;nodata]No product</p>
with
<p>[onshow;block=p;when [product.*]=0]No product</p>
But when there is no products text 'No product' didn't show. The out put is:
<table>
  <tr>
    <td>
     
     
    </td>
  </tr>
</table>
By: Eugef
Date: 2006-10-06
Time: 16:24

Re: Can't use 'bmagnet' with 'nodata'

The code
<p>[onshow;block=p;when [product.#]=0]No product</p>
(i change [product.*] to [product.#]) works properly!
Thank you for help
By: Skrol29
Date: 2006-10-06
Time: 16:41

Re: Can't use 'bmagnet' with 'nodata'

You're rigth , sorry for that.