在看PHP168的分类信息.他的模板是怎么实现的?我有点不太明白
在index.php里require(Mpath."inc/head.php");
require(html("index",$index_tpl));
require(Mpath."inc/foot.php");
function html($html,$tpl=''){global $STYLE;if($tpl&&strstr($tpl,substr(ROOT_PATH,0,-1))&&file_exists($tpl)){return $tpl;}elseif($tpl&&file_exists(ROOT_PATH.$tpl)){return ROOT_PATH.$tpl;}elseif(file_exists(ROOT_PATH."template/".$STYLE."/".$html.".htm")){return ROOT_PATH."template/".$STYLE."/".$html.".htm";}elseif(file_exists(ROOT_PATH."template/default/".$html.".htm")){return ROOT_PATH."template/default/".$html.".htm";}
}html函数只是反回了路径.
一般的不是先把标签替换成PHP代码,然后再包含进来的吗?

解决方案 »

  1.   

    你看一下他的TPL的格式。说不定是这样的。<a><?= echo "ss"?></a>
      

  2.   

    他不是还有
    //伪静态
    if($webdb[NewsMakeHtml]==2)
    {
    $content=ob_get_contents();
    ob_end_clean();
    ob_start();
    $content=fake_html($content);
    echo "$content";
    }//真静态
    elseif($webdb[NewsMakeHtml]==1)
    {
    $content=ob_get_contents();
    ob_end_clean();
    ob_start(); //备用
    $content=make_html($content,'index');
    echo "$content";
    }吗?为什么视而不见呢?