Question: Is it possible to set variables outside of the stored template?
Context: I am making this template meant for use in the column colouring.
Code:
program:
## date = $#datecol;
now = format_date(today(), 'yyyy-MM-dd');
if days_between(date, now) <= '1' then '#aaaaa'
elif days_between(date, now) <= '3' then '#bbbbb'
elif days_between(date, now) <= '7' then '#ccccc'
fi
(though it's not quite working as expected - getting #aaaa for everything

)
Note that the date variable is commented out -- I tried saving it as a stored template, colours_days_between. then this in the template tester:
Code:
program:
date = $#fanficupdated;
colours_daysbetween()
It told me 'date' wasn't found.
I noticed this
Quote:
|
template(x) – evaluates x as a template. The evaluation is done in its own context, meaning that variables are not shared between the caller and the template evaluation.
|
so I'm thinking I'm doing this wrong but I'm not sure how to pass variables to the template - I noticed eval, but not sure if that's right.