Perhaps you are talking about something equivalent to Django blocks?
We do not have that.
We have other ways to do a similar thing. There are two basic things
you can do:

1) Extending
#extedened.html
<html><body>{{include}}</body></html>

#extending.html
{{extends 'extended.html'}}<h1>Hello<h1>

2) Including
#including.html
<html><body>{{include 'body.html'}}</body></html>

#body.html
<h1>Hello<h1>

And you can mix and match.
You can also pass functions to the extended function

Extending
#extedened.html
<html><body><h1>{{header()}}</h1>{{include}}<h1>{{footer()}}</h1></
body></html>

#extending.html
{{def header():}}This is the header{{return}}
{{def footer():}}This is the footer{{return}}
{{extends 'extended.html'}}<h1>Hello<h1>

and you can do these things in a try ... except to have a default:

<html><body><h1>{{try: header()}}{{except:}}default{{pass}}</h1>
{{include}}<h1>{{footer()}}</h1></body></html>

Massimo


On Nov 22, 7:18 am, jensmun <j...@acamedia.org> wrote:
> Hi,
>
> Typical case of embarrassing situation. I don't know anything about
> programming and wanted to try this out. Unfortunately I can't even get
> my head around extensions of views. And I can't seem to find a
> description of something this basic.
>
> I've tried stripped the example app in web2py from everything but a
> default controller, two views and the db-model. But I can't get the
> extension of views to work. And the Welcome-application is far too
> complicated for somebody like me to understand.
>
> I would be grateful for a pointer to some place which explains view
> and their extensions. If for example there are two places where I use
> <h1> how does the extension view know which of these two replace with
> the <h1> in the extension.
>
> Stupid question I know - but I've been trying to create a model and
> extension view which changes top "Welcome customize me" and not been
> succeeding.
>
> And Massimo's manual assumes a lot of this knowledge already I feel -
> since the examples moves quickly past how extensions change the parent-
> node.
>
> Grateful for any direction,
>
> Jens
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to