{block} {#language.function.block} ======= `{block}` is used to define a named area of template source for template inheritance. For details see section of [Template Inheritance](#advanced.features.template.inheritance). The `{block}` template source area of a child template will replace the corresponding areas in the parent template(s). Optionally `{block}` areas of child and parent templates can be merged into each other. You can append or prepend the parent `{block}` content by using the `append` or `prepend` option flag with the child's `{block}` definition. With the {\$smarty.block.parent} the `{block}` content of the parent template can be inserted at any location of the child `{block}` content. {\$smarty.block.child} inserts the `{block}` content of the child template at any location of the parent `{block}`. `{blocks}'s` can be nested. **Attributes:** Attribute Name Type Required Default Description ---------------- -------- ---------- --------- --------------------------------------- name string Yes *n/a* The name of the template source block **Option Flags (in child templates only):** Name Description --------- ------------------------------------------------------------------------------------------- append The `{block}` content will be be appended to the content of the parent template `{block}` prepend The `{block}` content will be prepended to the content of the parent template `{block}` hide Ignore the block content if no child block of same name is existing. nocache Disables caching of the `{block}` content parent.tpl {block name="title"}Default Title{/block} {block "title"}Default Title{/block} {* short-hand *} child.tpl {extends file="parent.tpl"} {block name="title"} Page Title {/block} The result would look like Page Title parent.tpl {block name="title"}Title - {/block} child.tpl {extends file="parent.tpl"} {block name="title" prepend} Page Title {/block} The result would look like Title - Page Title parent.tpl {block name="title"} is my title{/block} child.tpl {extends file="parent.tpl"} {block name="title" append} Page Title {/block} The result would look like Page title is my titel parent.tpl {block name="title"}The {$smarty.block.child} was inserted here{/block} child.tpl {extends file="parent.tpl"} {block name="title"} Child Title {/block} The result would look like The Child Title was inserted here parent.tpl {block name="title"}Parent Title{/block} child.tpl {extends file="parent.tpl"} {block name="title"} You will see now - {$smarty.block.parent} - here {/block} The result would look like You will see now - Parent Title - here See also [Template Inheritance](#advanced.features.template.inheritance), [`$smarty.block.parent`](#language.variables.smarty.block.parent), [`$smarty.block.child`](#language.variables.smarty.block.child), and [`{extends}`](#language.function.extends)