Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

How to load the content of parent template to child template

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
tani
Smarty n00b


Joined: 16 May 2013
Posts: 1

PostPosted: Thu May 16, 2013 4:47 am    Post subject: How to load the content of parent template to child template Reply with quote

I have a header template consisting of the main menu. On the basis of selection of the menu item, I have to load another content without affecting the header.tpl or reloading it.

I have tried template inheritance, but whenever i display child.tpl, the parent.tpl reloads. Please explain me how to load the content of child.tpl without reloading header.tpl.



header.tpl
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<head></head>
<body>
{block name="content"}
{$smarty.block.child}
{/block}
</body>
</html>


child.tpl
Code:
{extends file="header.tpl"}
{block name="content"}
<div id="container">
    <div id="content">
       <div class="contentheader">
           <p>Create Item</p>
        </div>
   </div>
</div>
{/block}


index.php
Code:
$smarty->display('child.tpl');
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP