[Koha-devel] [Koha] Help needed in Template

Chris Cormack chris at bigballofwax.co.nz
Sun Aug 8 12:43:00 CEST 2010


On 8 August 2010 22:33, Nitesh Rijal <rijal.it at gmail.com> wrote:
> Actually, I have the value as TRUE and FALSE.
> Isn;t there anyway to execute the code of it is TRUE like:
> if (fulltetxt == TRUE)
>     do this
> else
>    do this
> This is what I need, I have no idea how to set a variable true or false
> before passing to the template.

No you can't do that, you can use TMPL_EXPR but this is unsafe, the
only safe way to do it is to not set the variable to false, but just
to empty.

my $fulltext='';
if (some condition){
  $fulltext = 1;
}
$template->param('fulltext' => $fulltext);

Then in the template

<!-- TMPL_IF NAME="fulltext" -->

Chris


More information about the Koha-devel mailing list