织梦留言板调用头部脚部模板header/footer.htm

2019-10-24,,

织梦里的留言板guestbook.htm用{dede:include filename="head.htm"/}不能自动生成导航列表,不能使用模版default下的头文件,现在织梦58来写一个函数解决这问题:

 

第一步:打开"/include/common.func.php",该文件5.6版本以上默认存在,5.5的不存在自己建一个。

然后在该文件中加入一个函数,代码如下:

 

function pasterTempletDiy($path)

{

    require_once(DEDEINC."/arc.partview.class.php");

    global $cfg_basedir,$cfg_templets_dir;

    $tmpfile = $cfg_basedir.$cfg_templets_dir."/".$path;//模版文件的路径

    $dtp = new PartView();

    $dtp->SetTemplet($tmpfile);

    $dtp->Display();

}

第二步,打开留言本的模版文件,默认的是/templets/plus/guestbook.htm

用以下代码替换原因的调用头部代码

<?php

      pasterTempletDiy("default/header.htm");

?>

同理调用尾部代码

<?php

      pasterTempletDiy("default/footer.htm");

?>

如果调用栏目列表,新建个页面按照上面调用即可,这里的default是系统默认的模版文件,如果我们有自己的模版文件,替换成自己的文件名字即可。

《织梦留言板调用头部脚部模板header/footer.htm.doc》

下载本文的Word格式文档,以方便收藏与打印。