Smarty templates allow you two methods to include files. One method would be to use your ‘.php’ file and the other is to use the ‘.tpl’ file.
Method A
.php File
include("libs/smarty.class.php"); $smarty = new Smarty (); $smarty->display("includes/header.inc.tpl"); $smarty->display("include.tpl"); $smarty->display("includes/footer.inc.tpl");
.tpl File
<p> Here is some text from the main file. </p>
Method B
.php File
include("libs/smarty.class.php"); $smarty = new Smarty (); //$smarty->display("includes/header.inc.tpl"); $smarty->display("include.tpl"); //$smarty->display("includes/footer.inc.tpl");
.tpl File
{include file='includes/header.inc.tpl'} <p> Here is some text from the main file. </p> {include file='includes/footer.inc.tpl'}
Same Browser Output From Both Methods
Here is some text from the main file.
Add Custom Footer
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton