Categories > TinyButStrong general >

selective switching of html

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: jimmyb
Date: 2006-03-18
Time: 04:56

selective switching of html

i tried many options, but still can't find a elegant solution to this problem:

pls help me or give hints if possible, thanx in advance.

problem: switching html parts on and of depending on a (single)variable

fact: html belongs on the html side :-) php in the php file.

example of last solution::
php code=
if($somthingok){
    $snipbuttonon=' ';
    $snipbuttonoff='';
}else{
    $snipbuttonon='';
    $snipbuttonoff=' ';
}

html side=
<a href="go.php" class="button">[var.snipbuttonon;magnet=a]GO</a>
<font class="button">[var.snipbuttonoff;magnet=font]GO</font>


as you can see, depending on my var $somthingok, html will be switched on or off resulting in a link that becomes (de)activated.

I give this as an example, so pls dont tell me about the html code.
the idea behind the construction is more my problem.
Now i need 2 vars for 1 problem, and a strange inelegant construct.

can this be solved in an other way pls?
(i dont wanne put html on the php side btw)
By: NeverPanic
Date: 2006-03-18
Time: 16:39

Re: selective switching of html

If the text in the tag stays the same you can use the param mtype=m+m

e.g.:
<a href=""><span comment="you should really stop using font" class="someclass">[var.snipbuttonoff;magnet=a;mtype=m+m]GO</span></a>
This will remove the link, but keep the span when snipbuttonoff is empty.
By: Skrol29
Date: 2006-03-18
Time: 19:56

Re: selective switching of html

A variant, withtout using intermediate variables:
<a href="">
  <span comment="you should really stop using font" class="someclass">
    [var.somthingok;if [val]!='';then 'OK';else '';magnet=a;mtype=m+m]
  </span>
</a>