On Thu, Feb 18, 2010 at 4:08 AM, p_W <[email protected]> wrote:
> Is there a way to use partial templates or layouts like in most of the
> bigger frameworks? I just so I can include a header, footer, nav,
> etc?
I do it like this:
def render_template(name, *args, **kw):
return render[name](*args, **kw)
render = web.template.render("templates", globals={"render_template":
render_template})
And use it in site.tmpl like this:
$def with (page)
$:render_template("site/head.tmpl")
$:render_template("site/neck.tmpl", title=page.title)
$:render_template("site/body", page)
$:render_template("site/footer")
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.