TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Question with Conditional Display

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Cyric
Date: 2014-03-19
Time: 12:21

Question with Conditional Display

Hi! I'm having problems with conditional display.
I want to display a button only if the logged user id (a field on $_SESSION) is the same as the field in the row I'm displaying. This is the code:

<button type="button">[onload;block=button;when [comentarios.usuario_id] = [var._SESSION.usuario_id] ]</button>

The button does not appear even if  [comentarios.usuario_id] and [var._SESSION.usuario_id] have the same value. Am I missing something?

Thanks!
By: Sarah
Date: 2014-03-19
Time: 16:42

Re: Question with Conditional Display

I would guess that the 'onload' is throwing off the processing of the conditional block. Try:

<button type="button">[comentarios.usuario_id;block=button;when [comentarios.usuario_id] = [var._SESSION.usuario_id]]</button>