Categories > TinyButStrong general >

Conditional when question

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: pf
Date: 2006-06-28
Time: 16:07

Conditional when question

I don't understand why this doesn't work.  I just want the navbar to show only when my RecCnt is more than the # to display for each page.

The RecCnt ends up being 45 as confirmed with the first line "Search resulted..."


<center><b>Search resulted in [var.RecCnt] documents.<b></center>

<br>
<table border="1" align="center" cellpadding="2" cellspacing="0">
  <tr align="center">
    <td width="16"><a href="[var..script_name]?PageNum=[nv.first;endpoint;magnet=a;mtype=m+m]">|&lt;</a></td>
    <td width="16"><a href="[var..script_name]?PageNum=[nv.prev;endpoint;magnet=a;mtype=m+m]">&lt;</a></td>
    <td width="16"><a href="[var..script_name]?PageNum=[nv.page;block=td;navsize=3;navpos=centred]">[nv.page]</a></td>
    <td width="16" bgcolor="#C4E1E1"><strong>[nv.page;block=td;currpage]</strong></td>
    <td width="16"><a href="[var..script_name]?PageNum=[nv.next;endpoint;magnet=a;mtype=m+m]">&gt;</a></td>
    <td width="16"><a href="[var..script_name]?PageNum=[nv.last;endpoint;magnet=a;mtype=m+m]">&gt;|</a></td>
  </tr>[onload;block=table;when [var.RecCnt;noerr]>15]
</table>


By: Skrol29
Date: 2006-06-28
Time: 16:34

Re: Conditional when question

Hi PF,

Character ">" is not a valid operator for TBS. "-+" has been choosen instead just because it let the template HTML compatible.
By: pf
Date: 2006-06-28
Time: 16:59

Re: Conditional when question

Thank you.  That got it to show but when RecCnt is below 15 it still shows the nav bar.  I tried a search that had 11 records or 0 and it still shows.  Any ideas?
By: Skrol29
Date: 2006-06-28
Time: 17:22

Re: Conditional when question

Fist check if the global variable $RecCount has the exptected value when LoadTemplate() is called. Because your [onload] field containing the condition is processed during LoadTemplate().

If it's ok, then try your condition on another field with parameter "if". See if you have the expected result.
If not, then try to debug your condition by displying it outside a TBS field context.
By: pf
Date: 2006-06-28
Time: 21:11

Re: Conditional when question

Ok got it now.  I guess you learn something everyday.  I never knew the difference between onload and onshow.  Thanks for the explanation.   I guess onload worked everywhere I needed it but this time I needed onshow.  Also for the record -+ is < or less than.  I was looking for > or greater than which is +-.  That had me confused for a few since you put -+.

Thanks again for you help.