TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Remove section on merge, when data contains only 1 value.

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Michael Frey
Date: 2014-08-12
Time: 14:43

Remove section on merge, when data contains only 1 value.

Hi,

I am using bmagnet to hide a select box when there is no data in my array that I merge.

How could I trigger the same effect when my array only has length of 1?

I obviously do not need to show this box when there is only 1 value avaialable.

Thank you
By: Skrol29
Date: 2014-08-12
Time: 17:14

Re: Remove section on merge, when data contains only 1 value.

Can't you do this at the PHP side ?
You could empty the data if there is only one record.
By: Michael Frey
Date: 2014-08-12
Time: 17:19

Re: Remove section on merge, when data contains only 1 value.

Thanks for the response.

I will do that. I just wasn't sure if there isn't a way to achieve this with TBS.
By: Skrol29
Date: 2014-08-13
Time: 00:19

Re: Remove section on merge, when data contains only 1 value.

There is a way which is complicated : you can use a conditional block with [onshow] which is using the record count of the block. The record count is given with [my_block.#].
See http://www.tinybutstrong.com/manual.php#php_mergeblock_counting