> Hi group,
>
> I need some clarification on template inheritance of templator template of webpy. say i have basic.html and xyz.html. If i need to extend xyz.html from basic.html, how do i go about doing that ? can some one please throw light on this.
Is it what you want?
http://webpy.org/cookbook/layout_template
Basic concept is that any template accepts any variable you define in
the ``$def with`` line. That includes templates, naturally. For any
template, you can also define attributes with ``$var`` line. So, if
you have this in xyz:
$var title: My tempalte's title
and this in base:
$def with (child_template)
You can pass the child template as a variable to base template:
render.base(render.xyz())
and in base you can:
$:child_template
or:
<title>$child_template.title</title>
It's actually quite flexible, as you can see.
--
Branko Vukelić
bg.b...@gmail.com
stu...@brankovukelic.com
Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny
Gimp Brushmakers Guild
http://bit.ly/gbg-group
Templates really like python functions.
If you want to support something like layout template, then you need
to do like this:
render.layout(render.page(page))
Anand
--
You received this message because you are subscribed to the Google Groups "web.py" group.
To post to this group, send email to we...@googlegroups.com.
To unsubscribe from this group, send email to webpy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
You can't have a method call there. You could pass render.xyz() to
base, which is what I described in my reply.
> it will globally render against any template that is evaluated in the
> base.html (called from the render in code)?
I don't understand the concept of 'global rendering', but the template
instance will act just like any other variable you care passing to the
template.
> If so, it would be curious to know if variables for pagination, current
> link, other base-type functions could be passed in.
> i'll play with the first part first :)
It's like arguments for a function, really. If you know what x, y, and
z mean in:
def myfunc(x, y, z):
pass
then you can apply the same to Templetor templates.
This nvr seems to finish loading? http://milby.no-ip.org:8080/appointments/?action=register
::Sent from my Verizon HTC incredible gOS::