POST TIME:2017-11-13 00:38
前面有提到,在DEDEcms的/member和/plus文件夾下,有許多模板需要調用當前模板的頭部和尾部,但是筆者發現,同時使用同一個變量<?php pasterTempletDiy("head.htm"); ?>會出現問題,plus能正常使用,而會員中心卻打不開,其實解決辦法很簡單,就是單獨寫變量。方法如下
//引入arc.partview.class.php類處理 require_once(DEDEINC."/arc.partview.class.php"); function pasterTempletDiy($path) { global $cfg_basedir,$cfg_templets_skin; $tmpfile = $cfg_basedir.$cfg_templets_skin."/".$path;//模版文件的路徑 $dtp = new PartView(); $dtp->SetTemplet($tmpfile); $dtp->Display(); }
對應模板用
<?php pasterTempletDiy("head.htm"); ?> <?php pasterTempletDiy("footer.htm"); ?>
//引入arc.partview.class.php類處理////////////////////////////////////////////////////// require_once(DEDEINC."/arc.partview.class.php"); function pasterTempletDiy2($path) { global $cfg_basedir,$cfg_templets_skin; $tmpfile = $cfg_basedir.$cfg_templets_skin."/".$path;//模版文件的路徑 $dtp = new PartView(); $dtp->SetTemplet($tmpfile); $dtp->Display(); }
<?php pasterTempletDiy2("head.htm"); ?> <?php pasterTempletDiy2("footer.htm"); ?>