talexb has asked for the wisdom of the Perl Monks concerning the following question:

I am using Template Toolkit 2 and PostgreSQL -- but I seem to be having trouble getting boolean values from the database recognized by TT2's syntax. Has anyone else done this?

--t. alex
Life is short: get busy!

Replies are listed 'Best First'.
Re: Template Toolkit and booleans
by davorg (Chancellor) on Feb 11, 2003 at 16:49 UTC

    Sorry, but my copy of ESP::Guess seems to have a few bugs in it. You'll need to give us some code.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: Template Toolkit and booleans
by perrin (Chancellor) on Feb 11, 2003 at 16:54 UTC
    Are you using the DBI plugin or querying from Perl code and passing the values to TT?
      <table width="100%"><tr> [% FOREACH priv = [ "priv_upload", "priv_inspect", "priv_download", + "priv_admin" ] %] <td align="center">[% priv %] = "[%- line.priv -%]" </td> [% END %] </tr></table>

      I'm trying to use a loop to go through privileges for an account .. the variable 'priv' comes through fine but 'line.priv' comes up empty, perhaps because TT2 is looking for line.priv instead of line.priv_upload which is what I want. I'm not sure how I can get this interpolation to happen.

      --t. alex
      Life is short: get busy!
        [%- line.$priv - %]

        See the section on variable interpolation in the TT manual.