...
The file layout.tpl
should be taken into account.
This file is defined (by default) as follows:
- Include header.tpl file (if we display the contents)
- Include the desired template file
- Include footer.tpl file (if we display the contents)
- Include "Live Edit"
You can modify the contents of this file based on an entity type or entity itself.
Type of entity
When you want to change the layout as an entity type such as categories, you can define a file layout-EntityType.tpl defined as follows:
Code Block |
---|
{if !empty($display_header)}
{include file='../header.tpl' HOOK_HEADER=$HOOK_HEADER}
{/if}
{* Your template start here *}
{if !empty($display_footer)}
{include file='../footer.tpl'}
{/if}
{if !empty($live_edit)}
{$live_edit}
{/if} |
This file will be placed in: /themes/default/override/layout-category.tpl (For the category entity )
N.B.: a controller is an entity type. This means that you can use this feature for the supplier, stores, product, category, and many others entities.
By entity
When you want to change the layout according to a particular entity (e.g. for the product entity with ID 1) you can define a file-layout-EntityType-ID.tpl defined as:
Code Block |
---|
{if !empty($display_header)}
{include file='../header.tpl' HOOK_HEADER=$HOOK_HEADER}
{/if}
{* Your template start here *}
{if !empty($display_footer)}
{include file='../footer.tpl'}
{/if}
{if !empty($live_edit)}
{$live_edit}
{/if} |
This file will be placed in: /themes/default/override/layout-product-1.tpl (For the product entity with ID 1)
Dynamic template
It's possible to override the getOverrideTemplate from a FrontController to dynamically change the template.
General considerations theme URLs and form action
...