应该是没有问题的啊。注意一下模板的文件名及存放位置是否正确。为了调试,可以考虑将include_once("include/MyPhpClass.php");先注释掉

解决方案 »

  1.   

    位置都是正确的,因为可以显示index.tpl的内容,只是显示不了head.tpl和footer.tpl的内容
      

  2.   


     require("smarty.inc.php");
        include_once("include/MyPhpClass.php");
            $smarty=new Smarty;
        $smarty->assign("test","测试的内容");
        $smarty->assign("title","主页");
        $smarty->display("index.tpl");
    {include file="header.tpl" title=$title}
      

  3.   

    呵呵,用你的代码,我在本机输出没有任何错误。显示正确换上Smarty最新版本试试。
      

  4.   

    把index.tpl删了又重新建了一个,居然行了,莫名奇妙