Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value not available in sub-sub-template if render(..., {value = ...}) used in the template #770

Open
semyon422 opened this issue Jun 1, 2023 · 0 comments

Comments

@semyon422
Copy link

app.lua

local lapis = require("lapis")

local app = lapis.Application()
app:enable("etlua")

app:match("test", "/test", function(self)
    self.value_1 = "qwerty"
    self.context = {value_2 = "asdfgh"}
    return {render = true}
end)

return app

views/test.etlua

value_1 in test: <%= value_1 %><br>
value_2 in test: <%= context.value_2 %><br>
<% render("views.test_sub", context) %>

views/test_sub.etlua

value_1 in test_sub: <%= value_1 %><br>
value_2 in test_sub: <%= value_2 %><br>
<% render("views.test_sub_sub") %>

views/test_sub_sub.etlua

value_1 in test_sub_sub: <%= value_1 %><br>
value_2 in test_sub_sub: <%= value_2 %><br>

GET /test

value_1 in test: qwerty
value_2 in test: asdfgh
value_1 in test_sub: qwerty
value_2 in test_sub: asdfgh
value_1 in test_sub_sub: qwerty
value_2 in test_sub_sub: nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant