Categories > TinyButStrong general >

Conditional in Merged Array?!

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Marc Bender
Date: 2004-10-27
Time: 17:35

Conditional in Merged Array?!

Hi,

is it possible to use conditional in here?

[sb;block=td;p1=[mb.$];]

need to do something like:  if [sb.status]=notToday

and

if [sb.status]=true

within the block?

By: Skrol29
Date: 2004-10-27
Time: 17:44

Re: Conditional in Merged Array?!

I don't understand what you're trying to do.
Can you be more precise?
By: Marc Bender
Date: 2004-10-27
Time: 17:56

Re: Conditional in Merged Array?!

I got this block from a merged array

<tr>[mb;block=tr;]
  <td align="center" valign="middle" width="14%">
      <a href="index.php">
         [sb.time;block=td;p1=[mb.$];]
      </a>
  </td>
</tr>

what I want to do is to use a IF condition in the <td> like this:

<tr>[mb;block=tr;]
  <td align="center" valign="middle" width="14%">
    [if [sb.status]=something]
      <a href="index.php">
         [sb.time;block=td;p1=[mb.$];]
      </a>
    [/if]
    [else]
      no link here
    [/else]
  </td>
</tr>


sorry, i´m new in TBC, I want to use it in my project as alternate templating for XSL
By: Marc Bender
Date: 2004-10-27
Time: 18:02

Re: Conditional in Merged Array?!

by the way, I use TBS 2.0
By: Marc Bender
Date: 2004-10-27
Time: 18:18

Re: Conditional in Merged Array?!

I have found a way, but could this be possible without a <span> tag?


<tr>
    [mb;block=tr;]

    <span>
    [sb;block=span;p1=[mb.$];]
                                                                                   
        <td align="center" valign="middle" width="14%">

            <a href="index.php">
                [sb.date;]<br/>[sb.time;]
            </a>
           
            [onshow;block=td;when [sb.status]=1]
        </td>


        <td align="center" valign="middle" width="14%">
                           
            no<br/>
            show       
            [onshow;block=td;when [sb.status]=0]
        </td>

    </span>                                                                               
</tr>

By: Anonymous
Date: 2004-10-27
Time: 18:24

Re: Conditional in Merged Array?!

if I was you, I try this :

<tr>[mb;block=tr]
  <td align="center" valign="middle" width="14%">
      <a href="index.php">
         [sb.time;block=td;p1=[mb.$]][onload;block=a;if [sb.status]==1]
      </a>
  </td>
</tr>
By: peirgwnael
Date: 2004-10-27
Time: 18:24

Re: Conditional in Merged Array?!

Oups, it's from me... and not anonymous.
By: peirgwnael
Date: 2004-10-27
Time: 18:26

Re: Conditional in Merged Array?!

not onload, onshow !!!
Sorry
By: peirgwnael
Date: 2004-10-27
Time: 18:28

Re: Conditional in Merged Array?!

and not if, when
<tr>[mb;block=tr]
  <td align="center" valign="middle" width="14%">
      <a href="index.php">
         [sb.time;block=td;p1=[mb.$]][onshow;block=a;when [sb.status]==1]
      </a>
  </td>
</tr>

I use tbs 1.xx since some time and I'm not really ready in my mind (when in tbs2 and if in tbs1...)
By: Skrol29
Date: 2004-10-27
Time: 23:50

Re: Conditional in Merged Array?!

Your piece of template is ok.
You don't need the <span> tag, you can use "block=tr" for both blocks "mb" and "sb".
By: Skrol29
Date: 2004-10-27
Time: 23:52

Re: Conditional in Merged Array?!

> You don't need the <span> tag, you can use
> "block=tr" for both blocks "mb" and "sb".

There is also the solution of explicit syntax.
By: Skrol29
Date: 2004-10-28
Time: 01:15

Re: Conditional in Merged Array?!

This is a good solution.
There is an other one I can see.

It's to use magnet tags (called friend in TBS 1.x).
Example:
<tr>[mb;block=tr]
  <td align="center" valign="middle" width="14%">
      <a href="index.php">
      [sb.time;block=td;p1=[mb.$]]
      [sb.status;if [val]=1;then ' '; else '';magnet=a]
      </a>
  </td>
</tr>