当前位置 : 主页 > 建站教程 > dedecms >

dedecms制作xml格式的网站地图做法

来源:互联网 收集:自由互联 发布时间:2021-06-20
织梦dedecms制作xml格式的网站地图做法: 第一步:打开/dede/inc/inc_menu.php和/dede/inc/inc_menu_map.php文件,找到 m:item name=更新主页HTML link=makehtml_homepage.php rank=sys_MakeHtml target=main / 这一句并复制

 

织梦dedecms制作xml格式的网站地图做法:

第一步:打开/dede/inc/inc_menu.php和/dede/inc/inc_menu_map.php文件,找到 <m:item name='更新主页HTML' link='makehtml_homepage.php' rank='sys_MakeHtml' target='main' /> 这一句并复制一句,修改为:
<m:item name='更新Sitemap' link='makehtml_sitemap.php' rank='sys_MakeHtml' target='main' />   第二步:制作dede/makehtml_sitemap.php文件   直接拷贝一个dede/makehtml_homepage.php文件,找到$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet); $pv->SaveToHtml($homeFile);这段代码,将其注释或者直接删除,底部修改调用生成文件模板为makehtml_sitemap.htm,然后另存为makehtml_sitemap.php,上传至dede/即可。   第三步:制作后台更新模板文件dede/templets/makehtml_sitemap.htm   直接拷贝一个dede/templets/makehtml_homepage.htm文件,找到<input name="templet" type="text" id="templet" style="width:300″ value="<?php echo $row['templet']?>">和<td height="20″ valign="top" bgcolor="#FFFFFF"><input name="position" type="text" id="position" value="<?php echo $row['position']?>" size="30″> 这两段代码   分别修改为:<input name="templet" type="text" id="templet" style="width:300″ value="default/sitemap.xml">【注:default为织梦默认模板存放文件夹,如果你把网站模板单独放在另一个文件夹,这里的default就写你的模板存放文件夹】<td height="20″ valign="top" bgcolor="#FFFFFF"><input name="position" type="text" id="position" value="../sitemap.xml" size="30″>然后另存为makehtml_sitemap.htm,上传至dede/templets/;   第四步:制作sitemap模板文件 templets/sitemap.xml 将以下代码复制粘贴到记事本里,修改记事本名称为:sitemap.xml即可 <?xml version="1.0" encoding="gb2312"?> <?xml-stylesheet type="text/xsl" href="/templets/css/sitemap.xsl"?><!-- generator="dedecms/3.2" --> <urlset xmlns=" <url> <loc> <lastmod> {dede:arclist row=1 titlelen=30 orderby=pubdate} [field:pubdate function=strftime('%Y-%m-%d',@me)/] {/dede:arclist} </lastmod> <changefreq>daily</changefreq> <priority>1.0</priority> </url> {dede:channel row='30' type='top'} <url> <loc>[field:typelink /]</loc> <changefreq>daily</changefreq> <priority>0.8</priority> </url> {/dede:channel} {dede:arclist row=2000 orderby=pubdate} <url> <loc>[field:arcurl/]</loc> <lastmod>[field:pubdate function=strftime('%Y-%m-%d',@me)/]</lastmod> <changefreq>monthly</changefreq> <priority>0.5</priority> </url> {/dede:arclist} </urlset>   注:<?xml-stylesheet type="text/xsl" href="/templets/css/sitemap.xsl"?> 这里的sitemap.xsl文件,我会单独放一个页面中。sitemap.xsl文件主要是把xml格式的内容转换成具有一定样式的内容,这个文件引用的时候注意下文件所放位置,否则会显示错误。  
网友评论
相关栏目