webmcp

diff framework/env/slot/render_layout.lua @ 497:d89813dd4d92

New function request.add_error_handler(...); Allow layout_ident to be passed directly to slot.render_layout(...)
author jbe
date Sun Jul 23 02:51:13 2017 +0200 (2017-07-23)
parents be8ede894624
children
line diff
     1.1 --- a/framework/env/slot/render_layout.lua	Sun Jul 02 04:22:20 2017 +0200
     1.2 +++ b/framework/env/slot/render_layout.lua	Sun Jul 23 02:51:13 2017 +0200
     1.3 @@ -1,20 +1,23 @@
     1.4  --[[--
     1.5 -output =              -- document/data to be sent to the web browser
     1.6 -slot.render_layout()
     1.7 +output =             -- document/data to be sent to the web browser
     1.8 +slot.render_layout(
     1.9 +  layout_ident       -- if set, selects layout to be used; otherwise layout set by slot.set_layout(...) is used
    1.10 +)
    1.11  
    1.12  This function returns the selected layout after replacing all slot placeholders with the respective slot contents. If slot.set_layout(...) was called with nil as first argument, then no layout will be used, but only the contents of the slot named "data" are returned.
    1.13  
    1.14  --]]--
    1.15  
    1.16 -function slot.render_layout()
    1.17 -  if slot._current_layout then
    1.18 +function slot.render_layout(layout_ident)
    1.19 +  local layout_ident = layout_ident or slot._current_layout
    1.20 +  if layout_ident then
    1.21      local layout_file = assert(io.open(
    1.22        encode.file_path(
    1.23          WEBMCP_BASE_PATH,
    1.24          'app',
    1.25          WEBMCP_APP_NAME,
    1.26          '_layout',
    1.27 -        slot._current_layout .. '.html'
    1.28 +        layout_ident .. '.html'
    1.29        ),
    1.30        'r'
    1.31      ))

Impressum / About Us