Skip to content Skip to sidebar Skip to footer

Pass In Variable To Mako Template

In Perl, by using Template Toolkit, here is what I do Perl my $vars = { name => 'Count Edward van Halen', }; $tt->process('letters/overdrawn', $vars) || die $tt-

Solution 1:

Use named arguments

mytemplate.render(myvar1="var1", mydict=dict())

In the mako side you'd do

${myvar1}% for val in mydict:
    ${val}
% endfor

Post a Comment for "Pass In Variable To Mako Template"