Back to Examples Run Example

examples/example_helpers.py

from yatl.helpers import H1, INPUT

from py4web import action


@action("example_helpers")
@action.uses("examples/generic.html")
def example_helpers():
    return dict(a=H1("I am a title"), b=2, c=dict(d=3, e=4, x=INPUT(_name="test")))

templates/examples/generic.html

[[extend 'layout.html']]

<style>
.vars { padding: 5px 20px; text-align: center; }
.vars th:after { content: ": " }
.vars th, .vars td, .vars li { padding: 2px 5px; }
</style>

<div class="vars">
  [[=BEAUTIFY(__vars__)]]
<div>