Changes between Version 17 and Version 18 of DeveloperGuidelines/Templates


Ignore:
Timestamp:
11/02/15 14:14:52 (7 years ago)
Author:
Fran Boon
Comment:

Cascading Templates

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Templates

    v17 v18  
    5555* DeveloperGuidelines/Templates/CustomPages
    5656
     57== Cascading Templates ==
     58If you wish to inherit the functionality from another template & then make tweaks, you can do this by cascading templates:
     59
     60{{{modules/templates/MY_TEMPLATE/config.py}}}:
     61{{{
     62def config():
     63    from templates.OTHER_TEMPLATE.config import config as OTHER_config
     64    OTHER_config()
     65    settings.base.system_name = T("Other System Name")
     66    settings.base.system_name_short = T("Other Short System name")
     67}}}
     68
     69{{{modules/templates/MY_TEMPLATE/controllers.py}}}:
     70{{{
     71# Pull a page from another template
     72from templates.OTHER_TEMPLATE.controllers import other_page
     73# (This coukld be subclassed if-desired)
     74
     75# Define your own homepage:
     76class index():
     77    ...
     78}}}
     79
     80{{{modules/templates/MY_TEMPLATE/menus.py}}}:
     81{{{
     82from templates.OTHER_TEMPLATE.menus import S3OptionsMenu as OTHEROptionsMenu
     83class S3OptionsMenu(OTHEROptionsMenu):
     84    # Override those side menus which are specific.
     85}}}
     86
     87
    5788== References ==
    5889* BluePrint/Templates