uce/site/doc/pages/unit_render.txt

35 lines
792 B
Plaintext

:sig
void unit_render(String file_name)
void unit_render(String file_name, Request& context)
:params
file_name : UCE file to load and execute
context : optional request context to pass into the target page
:see
>ob
unit_call
unit_load
1_RENDER
component
:content
Calls another UCE file and executes its `RENDER(Request& context)` function.
If `context` is omitted, the current active request context is used.
Examples:
```cpp
// call a common page template
unit_render("page-template.uce");
// explicitly pass a request context
unit_render("page-template.uce", context);
```
Related:
- PHP: rendering another view or template with the current request state and captured output
- JavaScript / Node.js: calling another template renderer or SSR partial with the current request context