1

I am using HTML::Template::Pro in my perl application. I am displaying HTML elements in a loop and I want to show something after the second element of the loop. I added the loop_context_vars in my HTML::Template::Pro initialization, getting access to variables inside the loop (like __counter__).

Now I am looking for a way to check for a specific iteration of this loop to insert my HTML element.

<TMPL_IF __counter__ == 2>
   My new HTML element.
</TMPL_IF>

How can I access the __counter__ variable inside conditional statements in HTML::Template::Pro?

j0nes
  • 8,041
  • 3
  • 37
  • 40

1 Answers1

1

In HTML::Template::Pro, you can use expressions like in HTML::Template::Expr

<TMPL_IF EXPR="__counter__ == 2" >
    My new HTML element.
</TMPL_IF>
tinita
  • 3,987
  • 1
  • 21
  • 23