I’m having trouble getting HTML::Template‘s <TMPL_IF> blocks to function — it seems like my template is just skipping that code entirely.
<TMPL_LOOP NAME=DATA>
<TMPL_VAR NAME=complete><br>
<TMPL_IF NAME="complete">
<!-- Some HTML here -->
<TMPLE_ELSE>
<!-- Some other HTML here -->
</TMPL_IF>
</TMPL_LOOP>
The TMPL_VAR line is displaying the expected values, but nothing in the block below it is showing up whatsoever. The data structure I’m passing in to the template is:
$VAR1 = [
{
'code' => 26,
'message' => 'Start building sensors for Jarvis',
'complete' => 0
},
{
'code' => 33,
'message' => 'Machine learning to determine if actions are appropriate or not',
'complete' => 0
},
{
'code' => 37,
'message' => 'Play by genre audioserv method',
'complete' => 0
}
];
Any help is greatly appreciated — I’ve been banging my head against it for the last hour.
From the fine manual:
All your
completes are zero so<TMPL_IF>won’t show anything. You might expect the “else” branch to be displayed but you don’t have any<TMPL_ELSE>branches, you have<TMPLE_ELSE>. Fix the typo and try again.