in reply to Re^3: Preparing data for Template
in thread Preparing data for Template
Not in the Perl. But in the template, the line [% FOREACH project IN worklist(me.id) %] calls worklist as a function with the appropriate ID as its argument.
That confirms what I suspected - thanks
(But it seems to me that you shouldn't need to call a function from the template, unless the data will change based on some parameter from the template, like the me.id argument in the tutorial example. Since you're not feeding anything back to the function, why not just define frames as the arrayref rather than the coderef?)
This is a learning exercise rather than a complete solution. Totally agreed that a function is not needed here yet, but I'm trying to learn how to use functions within Templates so that, when I need them, I have a good grasp of how to implement them.
Update:
probably like [% FOREACH frame IN frames() %] (untested)
Yes - that is the part I omitted...thanks, that gets me further.
The subroutine is now being called. However, the values are not being passed back to the Template. Or, if they are, they are not getting displayed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Preparing data for Template
by hippo (Archbishop) on Dec 31, 2020 at 11:47 UTC | |
by Bod (Parson) on Dec 31, 2020 at 12:41 UTC | |
by Corion (Patriarch) on Dec 31, 2020 at 12:48 UTC | |
by Bod (Parson) on Dec 31, 2020 at 12:57 UTC | |
by haukex (Archbishop) on Dec 31, 2020 at 13:27 UTC | |
by LanX (Saint) on Dec 31, 2020 at 14:34 UTC | |
by Corion (Patriarch) on Dec 31, 2020 at 13:25 UTC | |
|
Re^5: Preparing data for Template
by GrandFather (Saint) on Jan 01, 2021 at 09:14 UTC | |
by Bod (Parson) on Jan 01, 2021 at 13:48 UTC |