混合方式
<?php$title="smarty学习";
$content="smarty模板的介绍";
?>
<html>
<head>
<title>
<?php echo $title;?></title>
</head>
<body>
<p><?php echo $content;?></p>
</body>
</html>
分为两个文件:
**.php
<?php
include("MyTpl.php");
$tpl = new MyTpl;
$title="smarty学习";
$content="smarty模板的介绍";
$tpl->assign($title,"nihao");
?>
**.html
<html>
<head>
<title>标题的变量占位符</title>
</head>
<body>
<p>内容变量占位符</p>
</body>
</html>