GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Wednesday, April 6, 2011

Smarty - Inheritance

To include another template file in a template file, for example you want to include footer and header
index.tpl
<html>
</head>
<title>Hello</title>
</head>
<body>
{include file="header.tpl" param="New York"}
<h1>Main Body</h1>
{include file="footer.tpl"}
</body>
</html>

What's the more powerful than this one is inheritance:
parent.tpl
<html>
<head>
<title>Hello</title>
</head>
<body>
{block name="content"}Default Content{/blcok}
</body>
</html>

child.tpl
{block name="content"}The New Content{/block}
Share/Bookmark

No comments:

Post a Comment