Registering layouts -- why?

I'm missing something regarding layouts -- I've been over and over the
wiki (/wiki/cbLayoutsViewsGuide) and I see the part about registering
your layout and assigning views (or a folder full of views) to it.

Here's what I can't quite grasp:

a) Why would you register a view to a layout? Is there a simple use
case to clarify the purpose of doing this?

b) once a view is registered to a layout what happens to it? Do you
still have to explicitly call it or is its output meant to get merged
into the return of #renderView()# ?

I'm thinking along the lines of having a layout with a static header/
footer

---- layout code ----
#renderView('header')#
#renderView()#
#renderView('footer')#
---- end layout code ----

If I register 'header' and 'footer' to that layout, how does my layout
code change? (or does it change at all?)

Incidentally I tried registering those two views as a test, but I'm
not sure what I should be seeing

cheers
CC

a) Why would you register a view to a layout? Is there a simple use
case to clarify the purpose of doing this?

This is a convenience to declare implicit relationships. Meaning you save yourself from typing in what layout the view should be rendered in. That’s it, just a convenience.

b) once a view is registered to a layout what happens to it? Do you
still have to explicitly call it or is its output meant to get merged
into the return of #renderView()# ?

Once you say: event.setView() the implicit assignments are checked in the request context and the view get’s a layout assigned to it if any.

I’m thinking along the lines of having a layout with a static header/
footer

---- layout code ----
#renderView(‘header’)#
#renderView()#
#renderView(‘footer’)#
---- end layout code ----

For the example shown, when you call renderView(‘header’) you do not need a layout definition for them. Those are explicit renderings, you want a view and that’s it. The assignment of views are done when you call: event.setView() ONLY!

gotcha - that's nice and clear. Thanks, Luis.