Categories > TinyButStrong general >

magnet doesn't delete entire tag when no data

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: kle_py
Date: 2009-06-04
Time: 18:01

magnet doesn't delete entire tag when no data

Ok, it is probably some option i am missing.
I have a html template like:
<table>
<tr>
    <td>Title 1</td><td>Title 2</td><td>Title 3</td><td>Title 4</td>
</tr>
<tr>
    <td>[blk1.field1;block=tr;magnet=table]</td>
    <td>[blk1.field2]&nbsp;</td>
    <td>[blk1.field3]&nbsp;</td>
    <td>[blk1.field4]&nbsp;</td>
</tr>
<tr>
    <td colspan="4">
    [blk1.field_special;block=tr;magnet=table;when [var.auth.user]=[blk1.id]]&nbsp;</td>
</tr>
</table>
    <div align="center" ><b>[blk1;block=div;nodata]No data found</b></div>
however when i have no data, y want the entire table to disappear and only see the message in the additional div tag.

But what i get is:
<table>
<tr>
    <td>Title 1</td><td>Title 2</td><td>Title 3</td><td>Title 4</td>
</tr>
<div align="center" ><b>No data found</b></div>
I get still the titles of the table, but no closing tag of the table.
I tried several parameters of magnet/bmagnet and mtype options but not got the result i wanted.

Thanks skrol29 for TBS, it is a great tool !!
By: Skrol29
Date: 2009-06-05
Time: 09:48

Re: magnet doesn't delete entire tag when no data

Hi Kle Py,

This is a normal behavior, and somehow quite logical.
If you have "block=tr" then the merged field cannot reach the tag "table" because it is outside the merged block.

If you want to delete a tag when there is no data, then use parameter "bmagnet" instead.
By: kle_py
Date: 2009-06-05
Time: 22:40

Re: magnet doesn't delete entire tag when no data

The strange thing is the "broken" table !!
I get an initial table tag, but there is no closing tag !

When reducing my model to (no titles, no additional conditional block):
<table>
<tr>
    <td>[blk1.field1;block=tr;bmagnet=table]</td>
    <td>[blk1.field2]&nbsp;</td>
    <td>[blk1.field3]&nbsp;</td>
    <td>[blk1.field4]&nbsp;</td>
</tr>
</table>
<div align="center" ><b>[blk1;block=div;nodata]No data found</b></div>
I get on no data:
<table>
<div align="center" ><b>No data found</b></div>
... no closing TABLE tag !!

Seems bmagnet deletes data only as if it were "mtype=*m" and doesn't catch the beginning ??
p.s. i am using tbs3.40 with Xampp 1.6.5 (PHP5.2.5)
By: kle_py
Date: 2009-06-08
Time: 22:52

Re: magnet doesn't delete entire tag when no data

oops,
seems i didn't obey rule 4 of Your golden rules :(,

Because i started using tr for the block area, but on nodata y defined a div - outside the table...
I think this is why the end of the table was clipped of, and bmagnet did not work any more !! (it is no problem, as long as there IS data)

I am doing for now a workaround checking the rowcount as onshow condition for the subsequent div.
Not so "clean" as i had wanted, but works ;).