| 在dedecms当中,所有的后台栏目,都是指定所建的htm代码,进而网站会输出内容。最模板这次二次开发网站,有幸找了写该函数。 如下:
function GetTempletFile()
{
global $cfg_basedir,$cfg_templets_dir,$cfg_df_style;
$cid = $this->ChannelUnit->ChannelInfos['nid'];
if(!empty($this->Fields['templet']))
{
$filetag = MfTemplet($this->Fields['templet']);
// if( !preg_match("#\/#", $filetag) ) $filetag = $GLOBALS['cfg_df_style'].'/'.$filetag;
}
else
{
$filetag = MfTemplet($this->TypeLink->TypeInfos["temparticle"]);
}
$tid = $this->Fields['typeid'];
$filetag = str_replace('{cid}', $cid,$filetag);
$filetag = str_replace('{tid}', $tid,$filetag);
$tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$filetag;
if($cid=='spec')
{
if( !empty($this->Fields['templet']) )
{
$tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$filetag;
}
else
{
$tmpfile = $cfg_basedir.$cfg_templets_dir."/{$cfg_df_style}/article_spec.htm";
}
}
if(!file_exists($tmpfile))
{
$tmpfile = $cfg_basedir.$cfg_templets_dir."/{$cfg_df_style}/".($cid=='spec' ? 'article_spec.htm' : 'article_default.htm');
}
if (!preg_match("#.htm$#", $tmpfile)) return FALSE;
return $tmpfile;
}
(责任编辑:最模板)关键部分是 $tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$filetag; 意思 文章页调用不同模型下的指定模板。 $filetag = MfTemplet($this->TypeLink->TypeInfos["temparticle"]); 以这个循环指定。 那么如果做单独页,需要指定某个模板,直接修改$tmpfile 就可以了。 |

Everything store外贸通用商城
人气:112
ecshop仿OPPO手机商城整站程
人气:1226
ecshop拉夫红酒模板|红酒商
人气:957
ecshop微信分销系统2016版
人气:1294
免费ecshop仿小米商城模板
人气:17098
ecshop 商品详细页 快速订购
人气:1998