You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
your package is very good, but I have got a problem when using variable in partials, it works fine when the code is in the root template, but if I try to do the same thing in a partial, the increment doesn't work and throw an exception saying the variable is not defined (or cannot find the variable something like that cannot remember the exact massage)
Sorry for taking so long to get back to you - it's been extremely busy at work!
I've had a quick look at the code to refresh my memory as I haven't touched Nettle for a while. Every time a partial is rendered it gets a new template context (this contains the model data and variables etc). I clone the parent context and then overwrite the model with the partials model (if there is one, otherwise it gets the parents model). But then I clear the variables collection - I do this to ensure variables are 'scoped' to their current context. This is likely to be why you are getting the error - although it would be good to see more of the source code causing your particular problem to get more context.
If this is being caused by what I think it is, then I will need to have a think about how to handle this problem better. Are you defining the index variable in the root template and then trying to increment it within the partial?
Thanks,
Craig
craigbridges
changed the title
using variable in partials
Using variables in partials
Jun 20, 2019
Hi Craig,
your package is very good, but I have got a problem when using variable in partials, it works fine when the code is in the root template, but if I try to do the same thing in a partial, the increment doesn't work and throw an exception saying the variable is not defined (or cannot find the variable something like that cannot remember the exact massage)
The text was updated successfully, but these errors were encountered: