Categories > TinyButStrong general >

no output value just magnet

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: SunWuKung
Date: 2007-01-20
Time: 15:09

no output value just magnet

Hi, can somebody tell me how to achieve the following:
- if sc.mid has a value output nothing
- if sc.mid has no value remove the surrounding tag

[sc.mid; magnet=div] - my problem with this one is that I don't want to output the value of sc.mid, I only want to decide if the div tag should appear or not

Thanks for the help.
SWK
By: sheepy
Date: 2007-01-20
Time: 19:26

Re: no output value just magnet

The simplest solution is warp it up in comment, so that the value is not visible.

<div><!--[sc.mid; magnet=div]--></div>

You may also do a convertion on PHP/SQL side (maybe inconvinence), or do an if then (make the tag looks long).

My solution, since I use this functionality a lot, is to add a parameter that does exactly that in my Plus plugin.  However the plugin itself incur a performance hit.

v1.02: [sc.mid; 2space; magnet=div]
v1.03: [sc.mid;_;magnet=div]
By: SunWuKung
Date: 2007-01-24
Time: 12:10

Re: no output value just magnet

Hi sheepy!
The comma technique is a good and simple one - thanks.

I started to look at your Plus plugin and indeed it looks very useful.
In the example that you have given [sc.mid; 2space; magnet=div] the second parameter is what to output if in place of the whole div tag if sc.mid is empty?

Do you think that the performance hit caused by Plus is significant (eg. more than 10% increase)?

Thx.
SWK