/ Published in: HTML
                    
                                        
This allows you to collect some snippets of  or  tags from any subtemplate, and place them in the  of your base template, no matter how you skip some templates in the chain.
Note how you could skip the definition of head() in the layout1_base.html file.
                Note how you could skip the definition of head() in the layout1_base.html file.
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
## base.html
<head>
<!-- blah blah -->
${self.head()}
</head>
<%def name="head()">
## Base definition (empty), override in subtemplates, and call
## ${parent.head()} somewhere in your definition.
</%def>
## layout1_base.html
<%inherit file="base.html" />
<%def name="head()">
${parent.head()}
</%def>
## view for controller X
<%inherit file="layout1_base.html" />
<%def name="head()">
${parent.head()}
<link rel="stylesheet" type="text/css" href="/css/woohoo.css" />
</%def>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                