Child template Inherits Parent template
1, through the <{extends}> tag inheritance
<{extends file= ' parent.html '}>
Must be written in the first row of the child template, and all subsequent content will be ignored
Overwrite the contents of the parent template or append to the child template
Overwrite the contents of the parent template
<{block name= ' title '}>
The contents of a child template
<{/block}>
Will overwrite the contents of the block with the same name in the parent template (name= ' title ')
<{block name= ' title '}>
Content in the parent template
<{/block}>
Append content to the parent template in a child template
<{extends file= ' parent.html '}>
<{block name= ' title ' Prepend}>
I was appended to the previous content--
<{/block} >
<{block name= ' content ' append}>
<br/>--I was appended at the back
Prepend will append the contents of the child template block to the front of the contents of the same block in the parent template
Append is appended to the back
prepend and append can act on the same block at the same time
Block Content1 in the parent template above, no content defined,
<{$smarty .block.child}> indicates that the contents of the block with the same name in the child template will be displayed
<{block name= ' title '}>
newly added--<{$smarty .block.parent}>
<{/block}>
Similarly, "newly added--<{$smarty .block.parent}>" in a child template
Indicates that the content in the block is "newly added-(plus content in a block of the same name in the parent template)"
Similar to extends <{include file= ' parent.html '}>