Specialising slot
-based Layouts
layout/products:
%% into layout/main %% block header This is a new header for this section. It's a block so you can't re-define it. %% end %% slot content This is some new default content for this section. It's a slot so you can over-ride it. %% end %% end --EOF--look inside...
Thus Spake Andy:
We can "subclass" our master layout to create a slightly different layout.
For example, we might want to define a different header for all the
product pages in a web site. If we define the header
as a block
then
it fixes the new header in place. A block
blocks any further replacement
(similar to the final
keyword in Java which prevents a method from being
re-defined by subclasses). In contrast, we define the content
as a slot
so that other templates can continue to slot in an alternative.