Forum Moderators: coopster
For example, assume that my template includes only a header and footer with a content cell in the middle. I'm looking for a solution for a multi-page site, where I can create files by calling one template. Therefore, I need to know how to include php code in the php file (which is calling the template) and not hard coded into the template itself.
Can it be done in Smarty?
mypage1.tpl
------------
{include file="header.tpl"}
Here is my page 1 text.
Here is my page 1 text.
{include file="footer.tpl"}
mypage2.tpl
------------
{include file="header.tpl"}
Here is my page 2 text.
Here is my page 2 text.
{include file="footer.tpl"}
and in your php file where you initialize Smarty
switch($page_id) {
case 'page1':
$smarty->display("mypage1.tpl");
break;
case 'page2':
$smarty->display("mypage2.tpl");
break;
}