On Saturday, November 10, 2007 12:08:02 AM UTC-8, Anand wrote:
>
>
> On 10-Nov-07, at 1:15 PM, Sutabi wrote:
>
> >
> > Is there some builtin method for including templates within other
> > templates?
>
> ... add render to template.Template.globals and access $:render.foo()
> in other templates.
>
Inspired by this, I did the following.
Now within a template, I can say
$:include.foo(arg1, arg2)
to include the foo template with args (but without the base template).
glo = {
...
}
# the rendering function
render = web.template.render(TMPLDIR, globals=glo, base='base')
# this allows us to "include" templates in other templates
# note no "base" for included templates
glo['include'] = web.template.render(TMPLDIR, globals=glo)
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/groups/opt_out.