Categories > TinyButStrong general >

Missing feature; removing empty elements with onshow

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: RwD
Date: 2005-05-19
Time: 14:12

Missing feature; removing empty elements with onshow

The follwoing snippet appears in a block (section_main) of my template.
<img src="test.jpg" [onshow; when '[section_main.#; noerr]' == '1'; block=img]>
So onshow the rownumber for section_main is merged in and I want the image to disappear for all but the first row. Using block this is impossible...

I would have expected the onshow field to use magnet and mtype because it is not part of a block but more a single field!!

This is what I would have expected from tbs to work, which to me makes more sense and should be able to handle empty elements like the image element:
<img src="test.jpg" [onshow; when '[section_main.#; noerr]' == '1'; magnet=img; mtype=m*]>
By: Skrol29
Date: 2005-05-19
Time: 14:56

Re: Missing feature; removing empty elements with onshow

Hi Rwd,

What you ask is possible but you're using the wrong parameters.

block=img cannot work, because <img> has no closing tag. TBS is not supposed to know that. (maybe I could had an extra parameter to tell him so). So your first snippet is ok if you use the explicit syntax.

If you don't want the explicit syntax, then the TBS tag cannot be a block.
Parameter 'when' is only for blocks. It is ignored for a tag which is a field. Use parameter 'if' for Field instead.

[onshow] automatic tags, can be Fields or Blocks depending to the presence of parameter 'block'.

So, the following snippet should work:
<img src="test.jpg" [onshow;if '[section_main.#;noerr]' == '1'; then ' ' ; else ''; magnet=img; mtype=m*]>



By: RwD
Date: 2005-05-19
Time: 15:11

Re: Missing feature; removing empty elements with onshow

Seems I looked at it from the wrong perspective. So the "then ' '" makes tbs output something so the magnet element is kept?? I didn't know about that functionality, guess I either read the manual badly or I forgot...

Thanks
By: Skrol29
Date: 2005-05-19
Time: 15:48

Re: Missing feature; removing empty elements with onshow

> makes tbs output something so the magnet element is kept??

Yes. This important detail is mentioned in the manual.