网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 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=http://www.google.com/schemas/sitemap/0.84>
    <url>
    <loc>http://www.software8.co</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格式的内容转换成具有一定样式的内容,这个文件引用的时候注意下文件所放位置,否则会显示错误。
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/14 15:52:50