LOAD() might not be a bad option. You can pass in args or vars to specify 
different snippets.

I offer my users the ability to define the page header and have a simple 
function in models that picks the header based on the sub-domain.

def _page_header():
    sub_domain = request.env.http_host.split('.')[0]
    header = 
db(db.auth_user.name==sub_domain).select(db.auth_user.header).first()
    if header and len(header)>0:
        return header.header
    else:
        return None
        
page_header = XML(_page_header())

And then in my layout.html:

        {{block header}}
            {{if page_header:}}
                {{=page_header}}
            {{else:}}
                
{{try:}}{{=auth.navbar(action=URL('default','user'))}}{{except:pass}}
                <div 
id="logo">{{=A(IMG(_src=URL('static','images/logo.png'), _width='200'), 
_href=URL(c='default', f='home'))}}
                </div>
                <div style="clear: both;"></div><!-- Clear the divs --> 
            {{pass}}
        {{end}}   

Reply via email to