Categories > TinyButStrong general >

Best way to hide block if query is empty.

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Cyric
Date: 2014-03-11
Time: 19:27

Best way to hide block if query is empty.

Hi there! I'm been using TBS for some time now, it's really great.

I wanted to know which is the proper way to hide a block if a query returns 0 values.

For example, let's suppose I have this:

<div id="userInfo">
[user.name]
</div>

And in the PHP file, I query the users table but I don't get any results. How can I hide the "userInfo" div?


I suppose it's a simple question but I've never really resolved in a "clean" way.

Thanks in advance!
Cyric

By: Sarah
Date: 2014-03-11
Time: 20:09

Re: Best way to hide block if query is empty.

By: Cyric
Date: 2014-03-11
Time: 20:36

Re: Best way to hide block if query is empty.

Hi Sarah. I tried that but I can't make it work. Maybe I'm doing someting wrong.

Here is my real code:

      <div id="podio">
        <h3>Podio de ganadores:</h3>
        <table>
          <tr><td>[podio.usuario;block=tr;magnet=div] <br /> [podio.victorias] victoria(s).</td></tr>
        </table>
      </div>
By: Sarah
Date: 2014-03-11
Time: 21:33

Re: Best way to hide block if query is empty.

Sorry, I did not notice you were using a block. You will probably want parameter 'bmagnet'
      <div id="podio">
        <h3>Podio de ganadores:</h3>
        <table>
          <tr><td>[podio.usuario;block=tr;bmagnet=div] <br /> [podio.victorias] victoria(s).</td></tr>
        </table>
      </div>
By: Cyric
Date: 2014-03-11
Time: 21:35

Re: Best way to hide block if query is empty.

It worked perfectly! Thanks a lot! :)